Skip to content

Commit 3db3526

Browse files
committed
clean up of python code for jupyter
1 parent 010ce13 commit 3db3526

4 files changed

Lines changed: 9 additions & 326 deletions

File tree

pythonFiles/PythonTools/ipythonServer.py

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@
2323
# Renamed in Python3k
2424
import _thread as thread
2525

26+
# Reference material
27+
# http://jupyter-client.readthedocs.io/en/latest/messaging.html
28+
# http://pydoc.net/Python/magni/1.4.0/magni.tests.ipynb_examples/
29+
# http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/_modules/pyquickhelper/ipythonhelper/notebook_runner.html
30+
2631
import visualstudio_py_util as _vspu
2732

2833
to_bytes = _vspu.to_bytes
@@ -119,18 +124,6 @@ def acquire(self):
119124
def release(self):
120125
self.lock.release()
121126

122-
123-
"""
124-
- Add a list with the command ids
125-
- Create a common lock object to be shared between iPythonKernelResponseMonitor and iPythonSocketServer
126-
- iPythonSocketServer will grab a lock and insert an item into the command ids and then send the code for execution
127-
- iPythonKernelResponseMonitor will keep going in a nutsy loop and when it gets a message for execution it will take the oldest item from the loop (pop)
128-
- and send a socket message providing the information (this way we can tie the code to be executed with the message ids)
129-
- Not the best, but that's how it will have to be done
130-
- http://www.xavierdupre.fr/app/pyquickhelper/helpsphinx/_modules/pyquickhelper/ipythonhelper/notebook_runner.html
131-
"""
132-
133-
134127
class iPythonKernelResponseMonitor(object):
135128

136129
def __init__(self, kernelUUID, socketConnection, send_lock, shell_channel, iopub_channel):
@@ -214,9 +207,7 @@ def start_processing(self, channel, *args):
214207

215208

216209
class iPythonSocketServer(object):
217-
"""back end for executing REPL code. This base class handles all of the
218-
communication with the remote process while derived classes implement the
219-
actual inspection and introspection."""
210+
"""back end for executing code in kernel. Handles all of the communication with the remote process."""
220211

221212
"""Messages sent back as responses"""
222213
_PONG = to_bytes('PONG')
@@ -241,10 +232,6 @@ def __init__(self):
241232
self.input_event.acquire()
242233
self.input_string = None
243234
self.exit_requested = False
244-
self.execute_item = None
245-
self.execute_item_lock = threading.Lock()
246-
# lock starts acquired (we use it like manual reset event)
247-
self.execute_item_lock.acquire()
248235
self.kernelMonitor = None
249236
self.shell_channel = None
250237

pythonFiles/PythonTools/jupyterTest.1.py

Lines changed: 0 additions & 177 deletions
This file was deleted.

0 commit comments

Comments
 (0)