mirror of
https://github.com/python/cpython.git
synced 2025-09-13 12:17:24 +00:00
[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:
parent
bfd9c3ea53
commit
cd39da75af
6 changed files with 31 additions and 14 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue