Show More
@@ -29,11 +29,13 b' jobs:' | |||||
29 | pip install mypy pyflakes flake8 |
|
29 | pip install mypy pyflakes flake8 | |
30 | - name: Lint with mypy |
|
30 | - name: Lint with mypy | |
31 | run: | |
|
31 | run: | | |
|
32 | set -e | |||
32 | mypy -p IPython.terminal |
|
33 | mypy -p IPython.terminal | |
33 | mypy -p IPython.core.magics |
|
34 | mypy -p IPython.core.magics | |
34 | mypy -p IPython.core.guarded_eval |
|
35 | mypy -p IPython.core.guarded_eval | |
35 | mypy -p IPython.core.completer |
|
36 | mypy -p IPython.core.completer | |
36 | - name: Lint with pyflakes |
|
37 | - name: Lint with pyflakes | |
37 | run: | |
|
38 | run: | | |
|
39 | set -e | |||
38 | flake8 IPython/core/magics/script.py |
|
40 | flake8 IPython/core/magics/script.py | |
39 | flake8 IPython/core/magics/packaging.py |
|
41 | flake8 IPython/core/magics/packaging.py |
@@ -11,7 +11,7 b' import signal' | |||||
11 | import sys |
|
11 | import sys | |
12 | import re |
|
12 | import re | |
13 | import os |
|
13 | import os | |
14 | from typing import Callable |
|
14 | from typing import Callable, Dict, Union | |
15 |
|
15 | |||
16 |
|
16 | |||
17 | from prompt_toolkit.application.current import get_app |
|
17 | from prompt_toolkit.application.current import get_app | |
@@ -143,10 +143,10 b' def create_ipython_shortcuts(shell, for_all_platforms: bool = False):' | |||||
143 | return paired |
|
143 | return paired | |
144 |
|
144 | |||
145 | focused_insert = (vi_insert_mode | emacs_insert_mode) & has_focus(DEFAULT_BUFFER) |
|
145 | focused_insert = (vi_insert_mode | emacs_insert_mode) & has_focus(DEFAULT_BUFFER) | |
146 | _preceding_text_cache = {} |
|
146 | _preceding_text_cache: Dict[Union[str, Callable], Condition] = {} | |
147 | _following_text_cache = {} |
|
147 | _following_text_cache: Dict[Union[str, Callable], Condition] = {} | |
148 |
|
148 | |||
149 | def preceding_text(pattern): |
|
149 | def preceding_text(pattern: Union[str, Callable]): | |
150 | if pattern in _preceding_text_cache: |
|
150 | if pattern in _preceding_text_cache: | |
151 | return _preceding_text_cache[pattern] |
|
151 | return _preceding_text_cache[pattern] | |
152 |
|
152 | |||
@@ -383,8 +383,8 b' def create_ipython_shortcuts(shell, for_all_platforms: bool = False):' | |||||
383 | self._input_mode = mode |
|
383 | self._input_mode = mode | |
384 |
|
384 | |||
385 | if shell.editing_mode == "vi" and shell.modal_cursor: |
|
385 | if shell.editing_mode == "vi" and shell.modal_cursor: | |
386 | ViState._input_mode = InputMode.INSERT |
|
386 | ViState._input_mode = InputMode.INSERT # type: ignore | |
387 | ViState.input_mode = property(get_input_mode, set_input_mode) |
|
387 | ViState.input_mode = property(get_input_mode, set_input_mode) # type: ignore | |
388 |
|
388 | |||
389 | return kb |
|
389 | return kb | |
390 |
|
390 |
@@ -50,7 +50,7 b' def raw_string_parenthesis(event: KeyPressEvent):' | |||||
50 | r".*(r|R)[\"'](-*)", |
|
50 | r".*(r|R)[\"'](-*)", | |
51 | event.current_buffer.document.current_line_before_cursor, |
|
51 | event.current_buffer.document.current_line_before_cursor, | |
52 | ) |
|
52 | ) | |
53 |
dashes = matches.group(2) |
|
53 | dashes = matches.group(2) if matches else "" | |
54 | event.current_buffer.insert_text("()" + dashes) |
|
54 | event.current_buffer.insert_text("()" + dashes) | |
55 | event.current_buffer.cursor_left(len(dashes) + 1) |
|
55 | event.current_buffer.cursor_left(len(dashes) + 1) | |
56 |
|
56 | |||
@@ -61,7 +61,7 b' def raw_string_bracket(event: KeyPressEvent):' | |||||
61 | r".*(r|R)[\"'](-*)", |
|
61 | r".*(r|R)[\"'](-*)", | |
62 | event.current_buffer.document.current_line_before_cursor, |
|
62 | event.current_buffer.document.current_line_before_cursor, | |
63 | ) |
|
63 | ) | |
64 |
dashes = matches.group(2) |
|
64 | dashes = matches.group(2) if matches else "" | |
65 | event.current_buffer.insert_text("[]" + dashes) |
|
65 | event.current_buffer.insert_text("[]" + dashes) | |
66 | event.current_buffer.cursor_left(len(dashes) + 1) |
|
66 | event.current_buffer.cursor_left(len(dashes) + 1) | |
67 |
|
67 | |||
@@ -72,7 +72,7 b' def raw_string_braces(event: KeyPressEvent):' | |||||
72 | r".*(r|R)[\"'](-*)", |
|
72 | r".*(r|R)[\"'](-*)", | |
73 | event.current_buffer.document.current_line_before_cursor, |
|
73 | event.current_buffer.document.current_line_before_cursor, | |
74 | ) |
|
74 | ) | |
75 |
dashes = matches.group(2) |
|
75 | dashes = matches.group(2) if matches else "" | |
76 | event.current_buffer.insert_text("{}" + dashes) |
|
76 | event.current_buffer.insert_text("{}" + dashes) | |
77 | event.current_buffer.cursor_left(len(dashes) + 1) |
|
77 | event.current_buffer.cursor_left(len(dashes) + 1) | |
78 |
|
78 |
General Comments 0
You need to be logged in to leave comments.
Login now