|
23 | 23 | # Renamed in Python3k |
24 | 24 | import _thread as thread |
25 | 25 |
|
| 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 | + |
26 | 31 | import visualstudio_py_util as _vspu |
27 | 32 |
|
28 | 33 | to_bytes = _vspu.to_bytes |
@@ -119,18 +124,6 @@ def acquire(self): |
119 | 124 | def release(self): |
120 | 125 | self.lock.release() |
121 | 126 |
|
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 | | - |
134 | 127 | class iPythonKernelResponseMonitor(object): |
135 | 128 |
|
136 | 129 | def __init__(self, kernelUUID, socketConnection, send_lock, shell_channel, iopub_channel): |
@@ -214,9 +207,7 @@ def start_processing(self, channel, *args): |
214 | 207 |
|
215 | 208 |
|
216 | 209 | 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.""" |
220 | 211 |
|
221 | 212 | """Messages sent back as responses""" |
222 | 213 | _PONG = to_bytes('PONG') |
@@ -241,10 +232,6 @@ def __init__(self): |
241 | 232 | self.input_event.acquire() |
242 | 233 | self.input_string = None |
243 | 234 | 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() |
248 | 235 | self.kernelMonitor = None |
249 | 236 | self.shell_channel = None |
250 | 237 |
|
|