Skip to content

Commit 1a1e983

Browse files
authored
Merge pull request #233 from Carreau/self.shell
Fix non-existing method.
2 parents f541cf4 + dc2ecfd commit 1a1e983

File tree

6 files changed

+20
-19
lines changed

6 files changed

+20
-19
lines changed

.github/workflows/python-package.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ jobs:
2525
python-version: ${{ matrix.python-version }}
2626
- name: Install dependencies
2727
run: |
28-
python -m pip install --upgrade pip
28+
python -m pip install --upgrade pip check-manifest
2929
pip install pytest nose
3030
pip install .
3131
python -m ipykernel.kernelspec --user
3232
- name: Test with pytest
3333
run: |
3434
pytest
35+
- name: Check Manifest
36+
run: |
37+
check-manifest

jupyter_console/app.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
from __future__ import print_function
1111

12-
import logging
1312
import signal
1413
import sys
1514

@@ -18,7 +17,7 @@
1817
)
1918
from traitlets.config import catch_config_error, boolean_flag
2019

21-
from jupyter_core.application import JupyterApp, base_aliases, base_flags, NoStart
20+
from jupyter_core.application import JupyterApp, base_aliases, base_flags
2221
from jupyter_client.consoleapp import (
2322
JupyterConsoleApp, app_aliases, app_flags,
2423
)
@@ -141,8 +140,6 @@ def initialize(self, argv=None):
141140
def init_banner(self):
142141
"""optionally display the banner"""
143142
self.shell.show_banner()
144-
# Make sure there is a space below the banner.
145-
#if self.log_level <= logging.INFO: print()
146143

147144
def start(self):
148145
# JupyterApp.start dispatches on NoStart

jupyter_console/ptshell.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@
5656
is_done,
5757
)
5858
from prompt_toolkit.history import InMemoryHistory
59-
from prompt_toolkit.patch_stdout import patch_stdout
6059
from prompt_toolkit.shortcuts.prompt import PromptSession
6160
from prompt_toolkit.shortcuts import print_formatted_text, CompleteStyle
6261
from prompt_toolkit.key_binding import KeyBindings
@@ -68,7 +67,7 @@
6867
from prompt_toolkit.styles import merge_styles
6968
from prompt_toolkit.styles.pygments import (style_from_pygments_cls,
7069
style_from_pygments_dict)
71-
from prompt_toolkit.formatted_text import PygmentsTokens, FormattedText
70+
from prompt_toolkit.formatted_text import PygmentsTokens
7271
from prompt_toolkit.output import ColorDepth
7372
from prompt_toolkit.utils import suspend_to_background_supported
7473

@@ -160,7 +159,7 @@ def get_completions(self, document, complete_event):
160159
):
161160
new_meta[c] = m["type"]
162161
meta = new_meta
163-
except:
162+
except Exception:
164163
pass
165164

166165
start_pos = content["cursor_start"] - document.cursor_position
@@ -748,8 +747,8 @@ def handle_execute_reply(self, msg_id, timeout=None):
748747
content = msg["content"]
749748
status = content['status']
750749

751-
if status == 'aborted':
752-
self.write('Aborted\n')
750+
if status == "aborted":
751+
self.shell.write("Aborted\n")
753752
return
754753
elif status == 'ok':
755754
# handle payloads
@@ -853,7 +852,6 @@ def handle_iopub(self, msg_id=''):
853852
while self.client.iopub_channel.msg_ready():
854853
sub_msg = self.client.iopub_channel.get_msg()
855854
msg_type = sub_msg['header']['msg_type']
856-
parent = sub_msg["parent_header"]
857855

858856
# Update execution_count in case it changed in another session
859857
if msg_type == "execute_input":

jupyter_console/tests/test_console.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,26 @@
1010
from subprocess import check_output
1111

1212
from nose import SkipTest
13+
import pytest
1314

1415
from traitlets.tests.utils import check_help_all_output
15-
from ipython_genutils.testing import decorators as dec
1616

17-
@dec.skip_win32
17+
18+
@pytest.mark.xfail
19+
@pytest.mark.skipif(sys.platform == "win32", reason="skip on windows")
1820
def test_console_starts():
1921
"""test that `jupyter console` starts a terminal"""
2022
p, pexpect, t = start_console()
21-
p.sendline('5')
22-
idx = p.expect([r'Out\[\d+\]: 5', pexpect.EOF], timeout=t)
23-
idx = p.expect([r'In \[\d+\]', pexpect.EOF], timeout=t)
23+
p.sendline("5")
24+
p.expect([r"Out\[\d+\]: 5", pexpect.EOF], timeout=t)
25+
p.expect([r"In \[\d+\]", pexpect.EOF], timeout=t)
2426
stop_console(p, pexpect, t)
2527

2628
def test_help_output():
2729
"""jupyter console --help-all works"""
2830
check_help_all_output('jupyter_console')
2931

32+
@pytest.mark.xfail
3033
def test_display_text():
3134
"Ensure display protocol plain/text key is supported"
3235
# equivalent of:
@@ -68,7 +71,7 @@ def start_console():
6871

6972
# timeout after one minute
7073
t = 60
71-
idx = p.expect(r'In \[\d+\]', timeout=t)
74+
p.expect(r"In \[\d+\]", timeout=t)
7275
return p, pexpect, t
7376

7477

jupyter_console/tests/test_image_handler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
from jupyter_console.ptshell import ZMQTerminalInteractiveShell
1212
from ipython_genutils.tempdir import TemporaryDirectory
1313
from ipython_genutils.testing.decorators import skip_without
14-
from ipython_genutils.ipstruct import Struct
1514

1615

1716
SCRIPT_PATH = os.path.join(
@@ -33,6 +32,7 @@ def setUp(self):
3332

3433
def test_call_pil_by_default(self):
3534
pil_called_with = []
35+
3636
def pil_called(data, mime):
3737
pil_called_with.append(data)
3838

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ universal=1
33

44
[flake8]
55
max-line-length = 99
6-
;ignore = E128, E124, E251, W503
6+
ignore = W291, E266, E265, E128, E251, E402, E124, E302, W293, E231, E222, W503, E126, E121, W391, E226, E127, W504
77

88
[metadata]
99
license_file = COPYING.md

0 commit comments

Comments
 (0)