Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Lu Xu
erp5
Commits
cf20478d
Commit
cf20478d
authored
Jan 24, 2017
by
Yusei Tahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert "Jupyter: Support displayhook."
This reverts commit
003e34c7
.
parent
7b9c2be7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
29 deletions
+13
-29
bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py
...teItem/portal_components/extension.erp5.JupyterCompile.py
+7
-23
bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.xml
...eItem/portal_components/extension.erp5.JupyterCompile.xml
+6
-6
No files found.
bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py
View file @
cf20478d
...
...
@@ -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
,
...
...
bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.xml
View file @
cf20478d
...
...
@@ -46,12 +46,12 @@
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<tuple>
<string>
W:3
83
, 10: Use of exec (exec-used)
</string>
<string>
W:4
26
, 10: Use of exec (exec-used)
</string>
<string>
W:4
39
, 10: Use of exec (exec-used)
</string>
<string>
W:5
26
, 6: No exception type(s) specified (bare-except)
</string>
<string>
W:7
79
, 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:3
69
, 10: Use of exec (exec-used)
</string>
<string>
W:4
12
, 10: Use of exec (exec-used)
</string>
<string>
W:4
25
, 10: Use of exec (exec-used)
</string>
<string>
W:5
10
, 6: No exception type(s) specified (bare-except)
</string>
<string>
W:7
63
, 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>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment