Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ayush Tiwari
erp5
Commits
003e34c7
Commit
003e34c7
authored
Jan 21, 2017
by
Yusei Tahara
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Jupyter: Support displayhook.
parent
6b6f1fe0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
13 deletions
+29
-13
bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.py
...teItem/portal_components/extension.erp5.JupyterCompile.py
+23
-7
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 @
003e34c7
...
@@ -170,18 +170,30 @@ def matplotlib_post_run(data_list):
...
@@ -170,18 +170,30 @@ def matplotlib_post_run(data_list):
metadata
=
{
'image/png'
:
dict
(
width
=
width
,
height
=
height
)}
metadata
=
{
'image/png'
:
dict
(
width
=
width
,
height
=
height
)}
data_list
.
append
(
json_clean
(
dict
(
data
=
data
,
metadata
=
metadata
)))
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
):
def
displayDataWrapper
(
function
):
with
display_data_wrapper_lock
:
with
display_data_wrapper_lock
:
# pre run
# pre run
displayhook
.
pre_run
()
matplotlib_pre_run
()
matplotlib_pre_run
()
extra_data_list
=
[]
result
=
function
()
try
:
extra_data_list
=
result
.
get
(
'extra_data_list'
,
[])
result
=
function
()
extra_data_list
=
result
.
get
(
'extra_data_list'
,
[])
# post run
finally
:
matplotlib_post_run
(
extra_data_list
)
# post run
displayhook
.
post_run
()
matplotlib_post_run
(
extra_data_list
)
result
[
'extra_data_list'
]
=
extra_data_list
result
[
'extra_data_list'
]
=
extra_data_list
return
result
return
result
...
@@ -348,6 +360,8 @@ def Base_runJupyterCode(self, jupyter_code, old_notebook_context):
...
@@ -348,6 +360,8 @@ def Base_runJupyterCode(self, jupyter_code, old_notebook_context):
transaction
.
abort
()
transaction
.
abort
()
result
=
{
result
=
{
'result_string'
:
"EnvironmentUndefineError: Trying to remove non existing function/variable from environment: '%s'
\
n
"
%
func_alias
,
'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
,
'notebook_context'
:
notebook_context
,
'status'
:
'ok'
,
'status'
:
'ok'
,
'mime_type'
:
'text/plain'
,
'mime_type'
:
'text/plain'
,
...
@@ -463,6 +477,8 @@ def Base_runJupyterCode(self, jupyter_code, old_notebook_context):
...
@@ -463,6 +477,8 @@ def Base_runJupyterCode(self, jupyter_code, old_notebook_context):
result
=
{
result
=
{
'result_string'
:
output
,
'result_string'
:
output
,
'print_result'
:
output
,
'displayhook_result'
:
displayhook
.
result
,
'notebook_context'
:
notebook_context
,
'notebook_context'
:
notebook_context
,
'status'
:
status
,
'status'
:
status
,
'mime_type'
:
mime_type
,
'mime_type'
:
mime_type
,
...
...
bt5/erp5_data_notebook/ExtensionTemplateItem/portal_components/extension.erp5.JupyterCompile.xml
View file @
003e34c7
...
@@ -46,12 +46,12 @@
...
@@ -46,12 +46,12 @@
<key>
<string>
text_content_warning_message
</string>
</key>
<key>
<string>
text_content_warning_message
</string>
</key>
<value>
<value>
<tuple>
<tuple>
<string>
W:3
69
, 10: Use of exec (exec-used)
</string>
<string>
W:3
83
, 10: Use of exec (exec-used)
</string>
<string>
W:4
12
, 10: Use of exec (exec-used)
</string>
<string>
W:4
26
, 10: Use of exec (exec-used)
</string>
<string>
W:4
25
, 10: Use of exec (exec-used)
</string>
<string>
W:4
39
, 10: Use of exec (exec-used)
</string>
<string>
W:5
10
, 6: No exception type(s) specified (bare-except)
</string>
<string>
W:5
26
, 6: No exception type(s) specified (bare-except)
</string>
<string>
W:7
63
, 6: Use of exec (exec-used)
</string>
<string>
W:7
79
, 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:
1005
, 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>
<string>
W: 18, 0: Unused log imported from Products.ERP5Type.Log (unused-import)
</string>
</tuple>
</tuple>
</value>
</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