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