|
76 | 76 | from pygments.util import ClassNotFound
|
77 | 77 | from pygments.token import Token
|
78 | 78 |
|
79 |
| -from jupyter_client.utils import run_sync |
80 |
| - |
81 | 79 |
|
82 | 80 | def ask_yes_no(prompt, default=None, interrupt=None):
|
83 | 81 | """Asks a question and returns a boolean (y/n) answer.
|
@@ -707,8 +705,8 @@ def run_cell(self, cell, store_history=True):
|
707 | 705 | return
|
708 | 706 |
|
709 | 707 | # flush stale replies, which could have been ignored, due to missed heartbeats
|
710 |
| - while run_sync(self.client.shell_channel.msg_ready)(): |
711 |
| - run_sync(self.client.shell_channel.get_msg)() |
| 708 | + while self.client.shell_channel.msg_ready(): |
| 709 | + self.client.shell_channel.get_msg() |
712 | 710 | # execute takes 'hidden', which is the inverse of store_hist
|
713 | 711 | msg_id = self.client.execute(cell, not store_history)
|
714 | 712 |
|
@@ -742,7 +740,7 @@ def run_cell(self, cell, store_history=True):
|
742 | 740 |
|
743 | 741 | def handle_execute_reply(self, msg_id, timeout=None):
|
744 | 742 | kwargs = {"timeout": timeout}
|
745 |
| - msg = run_sync(self.client.shell_channel.get_msg)(**kwargs) |
| 743 | + msg = self.client.shell_channel.get_msg(**kwargs) |
746 | 744 | if msg["parent_header"].get("msg_id", None) == msg_id:
|
747 | 745 |
|
748 | 746 | self.handle_iopub(msg_id)
|
@@ -782,7 +780,7 @@ def handle_is_complete_reply(self, msg_id, timeout=None):
|
782 | 780 | msg = None
|
783 | 781 | try:
|
784 | 782 | kwargs = {"timeout": timeout}
|
785 |
| - msg = run_sync(self.client.shell_channel.get_msg)(**kwargs) |
| 783 | + msg = self.client.shell_channel.get_msg(**kwargs) |
786 | 784 | except Empty:
|
787 | 785 | warn('The kernel did not respond to an is_complete_request. '
|
788 | 786 | 'Setting `use_kernel_is_complete` to False.')
|
@@ -851,8 +849,8 @@ def handle_iopub(self, msg_id=''):
|
851 | 849 |
|
852 | 850 | It only displays output that is caused by this session.
|
853 | 851 | """
|
854 |
| - while run_sync(self.client.iopub_channel.msg_ready)(): |
855 |
| - sub_msg = run_sync(self.client.iopub_channel.get_msg)() |
| 852 | + while self.client.iopub_channel.msg_ready(): |
| 853 | + sub_msg = self.client.iopub_channel.get_msg() |
856 | 854 | msg_type = sub_msg['header']['msg_type']
|
857 | 855 |
|
858 | 856 | # Update execution_count in case it changed in another session
|
@@ -1005,7 +1003,7 @@ def handle_image_callable(self, data, mime):
|
1005 | 1003 | def handle_input_request(self, msg_id, timeout=0.1):
|
1006 | 1004 | """ Method to capture raw_input
|
1007 | 1005 | """
|
1008 |
| - req = run_sync(self.client.stdin_channel.get_msg)(timeout=timeout) |
| 1006 | + req = self.client.stdin_channel.get_msg(timeout=timeout) |
1009 | 1007 | # in case any iopub came while we were waiting:
|
1010 | 1008 | self.handle_iopub(msg_id)
|
1011 | 1009 | if msg_id == req["parent_header"].get("msg_id"):
|
@@ -1034,6 +1032,6 @@ def double_int(sig, frame):
|
1034 | 1032 |
|
1035 | 1033 | # only send stdin reply if there *was not* another request
|
1036 | 1034 | # or execution finished while we were reading.
|
1037 |
| - if not (run_sync(self.client.stdin_channel.msg_ready)() or |
1038 |
| - run_sync(self.client.shell_channel.msg_ready)()): |
| 1035 | + if not (self.client.stdin_channel.msg_ready() or |
| 1036 | + self.client.shell_channel.msg_ready()): |
1039 | 1037 | self.client.input(raw_data)
|
0 commit comments