Commit cf20478d authored by Yusei Tahara's avatar Yusei Tahara

Revert "Jupyter: Support displayhook."

This reverts commit 003e34c7.
parent 7b9c2be7
......@@ -170,30 +170,18 @@ def matplotlib_post_run(data_list):
metadata = {'image/png':dict(width=width, height=height)}
data_list.append(json_clean(dict(data=data, metadata=metadata)))
class Displayhook(object):
def hook(self, value):
self.result = repr(value)
def pre_run(self):
self.old_hook = sys.displayhook
sys.displayhook = self.hook
self.result = ''
def post_run(self):
sys.displayhook = self.old_hook
displayhook = Displayhook()
def displayDataWrapper(function):
with display_data_wrapper_lock:
# pre run
displayhook.pre_run()
matplotlib_pre_run()
extra_data_list = []
try:
result = function()
extra_data_list = result.get('extra_data_list', [])
finally:
# post run
displayhook.post_run()
matplotlib_post_run(extra_data_list)
result = function()
extra_data_list = result.get('extra_data_list', [])
# post run
matplotlib_post_run(extra_data_list)
result['extra_data_list'] = extra_data_list
return result
......@@ -360,8 +348,6 @@ def Base_runJupyterCode(self, jupyter_code, old_notebook_context):
transaction.abort()
result = {
'result_string': "EnvironmentUndefineError: Trying to remove non existing function/variable from environment: '%s'\n" % func_alias,
'print_result': "EnvironmentUndefineError: Trying to remove non existing function/variable from environment: '%s'\n" % func_alias,
'displayhook_result': '',
'notebook_context': notebook_context,
'status': 'ok',
'mime_type': 'text/plain',
......@@ -477,8 +463,6 @@ def Base_runJupyterCode(self, jupyter_code, old_notebook_context):
result = {
'result_string': output,
'print_result': output,
'displayhook_result': displayhook.result,
'notebook_context': notebook_context,
'status': status,
'mime_type': mime_type,
......
......@@ -46,12 +46,12 @@
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple>
<string>W:383, 10: Use of exec (exec-used)</string>
<string>W:426, 10: Use of exec (exec-used)</string>
<string>W:439, 10: Use of exec (exec-used)</string>
<string>W:526, 6: No exception type(s) specified (bare-except)</string>
<string>W:779, 6: Use of exec (exec-used)</string>
<string>W:1005, 2: Redefining name \'IFrame\' from outer scope (line 4) (redefined-outer-name)</string>
<string>W:369, 10: Use of exec (exec-used)</string>
<string>W:412, 10: Use of exec (exec-used)</string>
<string>W:425, 10: Use of exec (exec-used)</string>
<string>W:510, 6: No exception type(s) specified (bare-except)</string>
<string>W:763, 6: Use of exec (exec-used)</string>
<string>W:989, 2: Redefining name \'IFrame\' from outer scope (line 4) (redefined-outer-name)</string>
<string>W: 18, 0: Unused log imported from Products.ERP5Type.Log (unused-import)</string>
</tuple>
</value>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment