Skip to content

Commit 846354e

Browse files
committed
Move shutdown request to its own section to emphasize the message is on the control channel.
1 parent c369247 commit 846354e

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

jupyter_client/client.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -407,8 +407,24 @@ def _handle_kernel_info_reply(self, msg):
407407
if adapt_version != major_protocol_version:
408408
self.session.adapt_version = adapt_version
409409

410+
def is_complete(self, code):
411+
"""Ask the kernel whether some code is complete and ready to execute."""
412+
msg = self.session.msg('is_complete_request', {'code': code})
413+
self.shell_channel.send(msg)
414+
return msg['header']['msg_id']
415+
416+
def input(self, string):
417+
"""Send a string of raw input to the kernel.
418+
419+
This should only be called in response to the kernel sending an
420+
``input_request`` message on the stdin channel.
421+
"""
422+
content = dict(value=string)
423+
msg = self.session.msg('input_reply', content)
424+
self.stdin_channel.send(msg)
425+
410426
def shutdown(self, restart=False):
411-
"""Request an immediate kernel shutdown.
427+
"""Request an immediate kernel shutdown on the control channel.
412428
413429
Upon receipt of the (empty) reply, client code can safely assume that
414430
the kernel has shut down and it's safe to forcefully terminate it if
@@ -428,21 +444,4 @@ def shutdown(self, restart=False):
428444
self.control_channel.send(msg)
429445
return msg['header']['msg_id']
430446

431-
def is_complete(self, code):
432-
"""Ask the kernel whether some code is complete and ready to execute."""
433-
msg = self.session.msg('is_complete_request', {'code': code})
434-
self.shell_channel.send(msg)
435-
return msg['header']['msg_id']
436-
437-
def input(self, string):
438-
"""Send a string of raw input to the kernel.
439-
440-
This should only be called in response to the kernel sending an
441-
``input_request`` message on the stdin channel.
442-
"""
443-
content = dict(value=string)
444-
msg = self.session.msg('input_reply', content)
445-
self.stdin_channel.send(msg)
446-
447-
448447
KernelClientABC.register(KernelClient)

0 commit comments

Comments
 (0)