Improve pyrepl type-annotation coverage (#119081)

This commit is contained in:
Alex Waygood 2024-05-17 06:13:24 -04:00 committed by GitHub
parent 100c7ab00a
commit 033f5c87f1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 31 additions and 14 deletions

View file

@ -48,6 +48,9 @@ from collections.abc import Callable, Collection
from .types import Callback, Completer, KeySpec, CommandName
MoreLinesCallable = Callable[[str], bool]
__all__ = [
"add_history",
"clear_history",
@ -94,7 +97,7 @@ class ReadlineAlikeReader(historical_reader.HistoricalReader, CompletingReader):
# Instance fields
config: ReadlineConfig
more_lines: Callable[[str], bool] | None = None
more_lines: MoreLinesCallable | None = None
def __post_init__(self) -> None:
super().__post_init__()
@ -287,7 +290,7 @@ class _ReadlineWrapper:
reader.ps1 = str(prompt)
return reader.readline(startup_hook=self.startup_hook)
def multiline_input(self, more_lines, ps1, ps2):
def multiline_input(self, more_lines: MoreLinesCallable, ps1: str, ps2: str) -> tuple[str, bool]:
"""Read an input on possibly multiple lines, asking for more
lines as long as 'more_lines(unicodetext)' returns an object whose
boolean value is true.