Skip to content

Commit d432fd0

Browse files
committed
fix client 8 compat
1 parent a91d624 commit d432fd0

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

jupyter_console/ptshell.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,6 @@
7676
from pygments.util import ClassNotFound
7777
from pygments.token import Token
7878

79-
from jupyter_client.utils import run_sync
80-
8179

8280
def ask_yes_no(prompt, default=None, interrupt=None):
8381
"""Asks a question and returns a boolean (y/n) answer.
@@ -707,8 +705,8 @@ def run_cell(self, cell, store_history=True):
707705
return
708706

709707
# 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()
712710
# execute takes 'hidden', which is the inverse of store_hist
713711
msg_id = self.client.execute(cell, not store_history)
714712

@@ -742,7 +740,7 @@ def run_cell(self, cell, store_history=True):
742740

743741
def handle_execute_reply(self, msg_id, timeout=None):
744742
kwargs = {"timeout": timeout}
745-
msg = run_sync(self.client.shell_channel.get_msg)(**kwargs)
743+
msg = self.client.shell_channel.get_msg(**kwargs)
746744
if msg["parent_header"].get("msg_id", None) == msg_id:
747745

748746
self.handle_iopub(msg_id)
@@ -782,7 +780,7 @@ def handle_is_complete_reply(self, msg_id, timeout=None):
782780
msg = None
783781
try:
784782
kwargs = {"timeout": timeout}
785-
msg = run_sync(self.client.shell_channel.get_msg)(**kwargs)
783+
msg = self.client.shell_channel.get_msg(**kwargs)
786784
except Empty:
787785
warn('The kernel did not respond to an is_complete_request. '
788786
'Setting `use_kernel_is_complete` to False.')
@@ -851,8 +849,8 @@ def handle_iopub(self, msg_id=''):
851849
852850
It only displays output that is caused by this session.
853851
"""
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()
856854
msg_type = sub_msg['header']['msg_type']
857855

858856
# Update execution_count in case it changed in another session
@@ -1005,7 +1003,7 @@ def handle_image_callable(self, data, mime):
10051003
def handle_input_request(self, msg_id, timeout=0.1):
10061004
""" Method to capture raw_input
10071005
"""
1008-
req = run_sync(self.client.stdin_channel.get_msg)(timeout=timeout)
1006+
req = self.client.stdin_channel.get_msg(timeout=timeout)
10091007
# in case any iopub came while we were waiting:
10101008
self.handle_iopub(msg_id)
10111009
if msg_id == req["parent_header"].get("msg_id"):
@@ -1034,6 +1032,6 @@ def double_int(sig, frame):
10341032

10351033
# only send stdin reply if there *was not* another request
10361034
# 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()):
10391037
self.client.input(raw_data)

jupyter_console/tests/test_console.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
from traitlets.tests.utils import check_help_all_output
1515

1616

17-
@pytest.mark.xfail
1817
@pytest.mark.skipif(sys.platform == "win32", reason="skip on windows")
1918
def test_console_starts():
2019
"""test that `jupyter console` starts a terminal"""
@@ -28,7 +27,7 @@ def test_help_output():
2827
"""jupyter console --help-all works"""
2928
check_help_all_output('jupyter_console')
3029

31-
@pytest.mark.xfail
30+
3231
def test_display_text():
3332
"Ensure display protocol plain/text key is supported"
3433
# equivalent of:

0 commit comments

Comments
 (0)