From 54eef59fe41ba0cb74ceb8d4523126107ccbd896 Mon Sep 17 00:00:00 2001 From: Nikita Sobolev Date: Sat, 29 Jan 2022 12:41:19 +0300 Subject: [PATCH] Improve `shlex.push_source` types (#7071) --- stdlib/shlex.pyi | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/stdlib/shlex.pyi b/stdlib/shlex.pyi index a979ac077..46998c596 100644 --- a/stdlib/shlex.pyi +++ b/stdlib/shlex.pyi @@ -1,6 +1,6 @@ import sys from _typeshed import Self -from typing import Any, Iterable, TextIO +from typing import Iterable, TextIO def split(s: str, comments: bool = ..., posix: bool = ...) -> list[str]: ... @@ -17,7 +17,7 @@ class shlex(Iterable[str]): quotes: str escapedquotes: str whitespace_split: bool - infile: str + infile: str | None instream: TextIO source: str debug: int @@ -36,8 +36,7 @@ class shlex(Iterable[str]): def push_token(self, tok: str) -> None: ... def read_token(self) -> str: ... def sourcehook(self, newfile: str) -> tuple[str, TextIO]: ... - # TODO argument types - def push_source(self, newstream: Any, newfile: Any = ...) -> None: ... + def push_source(self, newstream: str | TextIO, newfile: str | None = ...) -> None: ... def pop_source(self) -> None: ... def error_leader(self, infile: str | None = ..., lineno: int | None = ...) -> None: ... def __iter__(self: Self) -> Self: ...