Commit 38e0faea authored by Ivan Tyagov's avatar Ivan Tyagov

Clean up og Jupyter ERP5Kernel

Tests passing here:

https://nexedi.erp5.net/test_result_module/20161117-147BEEA9

/reviewed-on nexedi/slapos!118
parent a4bbb559
...@@ -43,7 +43,7 @@ md5sum = d7d4a7e19d55bf14007819258bf42100 ...@@ -43,7 +43,7 @@ md5sum = d7d4a7e19d55bf14007819258bf42100
[erp5-kernel] [erp5-kernel]
<= download-file-base <= download-file-base
filename = ERP5kernel.py.jinja filename = ERP5kernel.py.jinja
md5sum = eb07520fc189dcac2d3bd2db1368b1ba md5sum = a0d13f4f5a9cd22a7b5d2c901aa9faae
[kernel-json] [kernel-json]
<= download-file-base <= download-file-base
......
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
from ipykernel.kernelbase import Kernel from ipykernel.kernelbase import Kernel
from ipykernel.kernelapp import IPKernelApp from ipykernel.kernelapp import IPKernelApp
from IPython.core.display import HTML from IPython.core.display import HTML
import requests import requests
import json import json
...@@ -46,8 +44,7 @@ MAGICS = { ...@@ -46,8 +44,7 @@ MAGICS = {
'erp5_url': MagicInfo('erp5_url', 'url', True, False, True), 'erp5_url': MagicInfo('erp5_url', 'url', True, False, True),
'notebook_set_reference': MagicInfo('notebook_set_reference', 'reference', True, False, True), 'notebook_set_reference': MagicInfo('notebook_set_reference', 'reference', True, False, True),
'notebook_set_title': MagicInfo('notebook_set_title', 'title', False, False, True), 'notebook_set_title': MagicInfo('notebook_set_title', 'title', False, False, True),
'my_notebooks': MagicInfo('my_notebooks', '', True, True, False) 'my_notebooks': MagicInfo('my_notebooks', '', True, True, False)}
}
class ERP5Kernel(Kernel): class ERP5Kernel(Kernel):
""" """
...@@ -105,7 +102,6 @@ class ERP5Kernel(Kernel): ...@@ -105,7 +102,6 @@ class ERP5Kernel(Kernel):
""" """
# Set attributes only for magic who do have any varible to set value to # Set attributes only for magic who do have any varible to set value to
if magic_info.variable_name: if magic_info.variable_name:
try: try:
# Get the magic value recived via code from frontend # Get the magic value recived via code from frontend
magic_value = code.split()[1] magic_value = code.split()[1]
...@@ -181,8 +177,7 @@ class ERP5Kernel(Kernel): ...@@ -181,8 +177,7 @@ class ERP5Kernel(Kernel):
'reference': self.reference, 'reference': self.reference,
'title': self.title, 'title': self.title,
'request_reference': request_reference, 'request_reference': request_reference,
}, })
)
# Set value for status_code for self object which would later be used to # Set value for status_code for self object which would later be used to
# dispaly response after statement check # dispaly response after statement check
...@@ -311,8 +306,7 @@ class ERP5Kernel(Kernel): ...@@ -311,8 +306,7 @@ class ERP5Kernel(Kernel):
data = { data = {
'data': {mime_type: code_result}, 'data': {mime_type: code_result},
'metadata': {} 'metadata': {}}
}
self.send_response(self.iopub_socket, 'display_data', data) self.send_response(self.iopub_socket, 'display_data', data)
reply_content = { reply_content = {
...@@ -320,8 +314,8 @@ class ERP5Kernel(Kernel): ...@@ -320,8 +314,8 @@ class ERP5Kernel(Kernel):
# The base class increments the execution count # The base class increments the execution count
'execution_count': self.execution_count, 'execution_count': self.execution_count,
'payload': [], 'payload': [],
'user_expressions': {}, 'user_expressions': {}}
}
return reply_content return reply_content
if __name__ == '__main__': if __name__ == '__main__':
......
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