[3.13] Improve pyrepl type-annotation coverage (GH-119081) (#119415)

(cherry picked from commit 033f5c87f1)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
Miss Islington (bot) 2024-05-22 20:38:32 +02:00 committed by GitHub
parent bfd9c3ea53
commit cd39da75af
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 31 additions and 14 deletions

View file

@ -49,6 +49,9 @@ from collections.abc import Callable, Collection
from .types import Callback, Completer, KeySpec, CommandName
MoreLinesCallable = Callable[[str], bool]
__all__ = [
"add_history",
"clear_history",
@ -95,7 +98,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__()
@ -288,7 +291,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.