Skip to content

Commit f076f32

Browse files
committed
Add more type annotations
1 parent 0c1c24f commit f076f32

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
from enum import Enum
1414
from types import FrameType, TracebackType
1515
from typing import (
16-
Dict,
1716
Any,
1817
Iterable,
18+
Dict,
1919
List,
2020
Optional,
2121
Sequence,
2222
Tuple,
23-
Union,
2423
Type,
24+
Union,
2525
)
2626
from .._typing_compat import Literal
2727

@@ -55,7 +55,11 @@
5555
Interp,
5656
code_finished_will_parse,
5757
)
58-
from .manual_readline import edit_keys, cursor_on_closing_char_pair
58+
from .manual_readline import (
59+
edit_keys,
60+
cursor_on_closing_char_pair,
61+
AbstractEdits,
62+
)
5963
from .parse import parse as bpythonparse, func_for_letter, color_for_letter
6064
from .preprocess import preprocess
6165
from .. import __version__
@@ -105,15 +109,20 @@ class FakeStdin:
105109
In user code, sys.stdin.read() asks the user for interactive input,
106110
so this class returns control to the UI to get that input."""
107111

108-
def __init__(self, coderunner, repl, configured_edit_keys=None):
112+
def __init__(
113+
self,
114+
coderunner: CodeRunner,
115+
repl: "BaseRepl",
116+
configured_edit_keys: Optional[AbstractEdits] = None,
117+
):
109118
self.coderunner = coderunner
110119
self.repl = repl
111120
self.has_focus = False # whether FakeStdin receives keypress events
112121
self.current_line = ""
113122
self.cursor_offset = 0
114123
self.old_num_lines = 0
115-
self.readline_results = []
116-
if configured_edit_keys:
124+
self.readline_results: List[str] = []
125+
if configured_edit_keys is not None:
117126
self.rl_char_sequences = configured_edit_keys
118127
else:
119128
self.rl_char_sequences = edit_keys
@@ -236,7 +245,7 @@ class ReevaluateFakeStdin:
236245
"""Stdin mock used during reevaluation (undo) so raw_inputs don't have to
237246
be reentered"""
238247

239-
def __init__(self, fakestdin, repl):
248+
def __init__(self, fakestdin: FakeStdin, repl: "BaseRepl"):
240249
self.fakestdin = fakestdin
241250
self.repl = repl
242251
self.readline_results = fakestdin.readline_results[:]

0 commit comments

Comments
 (0)