Use a more precise return type for tokenize.untokenize() (#13366)

This commit is contained in:
Tomas R.
2025-01-16 20:59:29 +01:00
committed by GitHub
parent 67eebc5495
commit 2a461a2f79

View File

@@ -130,9 +130,8 @@ class Untokenizer:
if sys.version_info >= (3, 12):
def escape_brackets(self, token: str) -> str: ...
# the docstring says "returns bytes" but is incorrect --
# if the ENCODING token is missing, it skips the encode
def untokenize(iterable: Iterable[_Token]) -> Any: ...
# Returns str, unless the ENCODING token is present, in which case it returns bytes.
def untokenize(iterable: Iterable[_Token]) -> str | Any: ...
def detect_encoding(readline: Callable[[], bytes | bytearray]) -> tuple[str, Sequence[bytes]]: ...
def tokenize(readline: Callable[[], bytes | bytearray]) -> Generator[TokenInfo, None, None]: ...
def generate_tokens(readline: Callable[[], str]) -> Generator[TokenInfo, None, None]: ...