Improve shlex.push_source types (#7071)

This commit is contained in:
Nikita Sobolev
2022-01-29 12:41:19 +03:00
committed by GitHub
parent 7e79706ddd
commit 54eef59fe4

View File

@@ -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: ...