Skip to content

Commit 3dd1034

Browse files
committed
Add more type annotations
1 parent c44d917 commit 3dd1034

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

bpython/repl.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def clear(self) -> None:
337337

338338

339339
class Interaction(metaclass=abc.ABCMeta):
340-
def __init__(self, config: Config):
340+
def __init__(self, config: Config) -> None:
341341
self.config = config
342342

343343
@abc.abstractmethod
@@ -356,7 +356,7 @@ def file_prompt(self, s: str) -> str | None:
356356

357357

358358
class NoInteraction(Interaction):
359-
def __init__(self, config: Config):
359+
def __init__(self, config: Config) -> None:
360360
super().__init__(config)
361361

362362
def confirm(self, s: str) -> bool:
@@ -467,7 +467,7 @@ def cursor_offset(self, value: int) -> None:
467467
# not actually defined, subclasses must define
468468
cpos: int
469469

470-
def __init__(self, interp: Interpreter, config: Config):
470+
def __init__(self, interp: Interpreter, config: Config) -> None:
471471
"""Initialise the repl.
472472
473473
interp is a Python code.InteractiveInterpreter instance
@@ -851,7 +851,7 @@ def next_indentation(self) -> int:
851851
)
852852
if indentation and self.config.dedent_after > 0:
853853

854-
def line_is_empty(line):
854+
def line_is_empty(line: str) -> bool:
855855
return not line.strip()
856856

857857
empty_lines = takewhile(line_is_empty, reversed(self.buffer))
@@ -942,7 +942,7 @@ def copy2clipboard(self) -> None:
942942
else:
943943
self.interact.notify(_("Copied content to clipboard."))
944944

945-
def pastebin(self, s=None) -> str | None:
945+
def pastebin(self, s: str | None = None) -> str | None:
946946
"""Upload to a pastebin and display the URL in the status bar."""
947947

948948
if s is None:
@@ -956,9 +956,8 @@ def pastebin(self, s=None) -> str | None:
956956
else:
957957
return self.do_pastebin(s)
958958

959-
def do_pastebin(self, s) -> str | None:
959+
def do_pastebin(self, s: str) -> str | None:
960960
"""Actually perform the upload."""
961-
paste_url: str
962961
if s == self.prev_pastebin_content:
963962
self.interact.notify(
964963
_("Duplicate pastebin. Previous URL: %s. " "Removal URL: %s")
@@ -989,7 +988,7 @@ def do_pastebin(self, s) -> str | None:
989988

990989
return paste_url
991990

992-
def push(self, line, insert_into_history=True) -> bool:
991+
def push(self, line: str, insert_into_history: bool = True) -> bool:
993992
"""Push a line of code onto the buffer so it can process it all
994993
at once when a code block ends"""
995994
# This push method is used by cli and urwid, but not curtsies

0 commit comments

Comments
 (0)