mirror of
https://github.com/clearml/clearml
synced 2025-02-12 07:35:08 +00:00
Fix jupyter notebook display(...) convert to print(...)
This commit is contained in:
parent
1d0be8c8e1
commit
4333eed965
@ -339,8 +339,10 @@ class _JupyterObserver(object):
|
|||||||
try:
|
try:
|
||||||
import re
|
import re
|
||||||
replace_ipython_pattern = re.compile(r'\n([ \t]*)get_ipython\(\)')
|
replace_ipython_pattern = re.compile(r'\n([ \t]*)get_ipython\(\)')
|
||||||
|
replace_ipython_display_pattern = re.compile(r'\n([ \t]*)display\(')
|
||||||
except Exception:
|
except Exception:
|
||||||
replace_ipython_pattern = None
|
replace_ipython_pattern = None
|
||||||
|
replace_ipython_display_pattern = None
|
||||||
|
|
||||||
# main observer loop, check if we need to exit
|
# main observer loop, check if we need to exit
|
||||||
while not cls._exit_event.wait(timeout=0.):
|
while not cls._exit_event.wait(timeout=0.):
|
||||||
@ -427,6 +429,8 @@ class _JupyterObserver(object):
|
|||||||
# we will not be able to run them anyhow
|
# we will not be able to run them anyhow
|
||||||
if replace_ipython_pattern:
|
if replace_ipython_pattern:
|
||||||
script_code = replace_ipython_pattern.sub(r'\n# \g<1>get_ipython()', script_code)
|
script_code = replace_ipython_pattern.sub(r'\n# \g<1>get_ipython()', script_code)
|
||||||
|
if replace_ipython_display_pattern:
|
||||||
|
script_code = replace_ipython_display_pattern.sub(r'\n\g<1>print(', script_code)
|
||||||
|
|
||||||
requirements_txt = ''
|
requirements_txt = ''
|
||||||
conda_requirements = ''
|
conda_requirements = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user