Use PEP 570 syntax in stdlib (#11250)

This commit is contained in:
Shantanu
2024-03-09 14:50:16 -08:00
committed by GitHub
parent 63737acac6
commit 470a13ab09
139 changed files with 2412 additions and 2371 deletions

View File

@@ -7,26 +7,26 @@ __all__ = ["StartResponse", "WSGIEnvironment", "WSGIApplication", "InputStream",
class StartResponse(Protocol):
def __call__(
self, __status: str, __headers: list[tuple[str, str]], __exc_info: _OptExcInfo | None = ...
self, status: str, headers: list[tuple[str, str]], exc_info: _OptExcInfo | None = ..., /
) -> Callable[[bytes], object]: ...
WSGIEnvironment: TypeAlias = dict[str, Any]
WSGIApplication: TypeAlias = Callable[[WSGIEnvironment, StartResponse], Iterable[bytes]]
class InputStream(Protocol):
def read(self, __size: int = ...) -> bytes: ...
def readline(self, __size: int = ...) -> bytes: ...
def readlines(self, __hint: int = ...) -> list[bytes]: ...
def read(self, size: int = ..., /) -> bytes: ...
def readline(self, size: int = ..., /) -> bytes: ...
def readlines(self, hint: int = ..., /) -> list[bytes]: ...
def __iter__(self) -> Iterator[bytes]: ...
class ErrorStream(Protocol):
def flush(self) -> object: ...
def write(self, __s: str) -> object: ...
def writelines(self, __seq: list[str]) -> object: ...
def write(self, s: str, /) -> object: ...
def writelines(self, seq: list[str], /) -> object: ...
class _Readable(Protocol):
def read(self, __size: int = ...) -> bytes: ...
def read(self, size: int = ..., /) -> bytes: ...
# Optional: def close(self) -> object: ...
class FileWrapper(Protocol):
def __call__(self, __file: _Readable, __block_size: int = ...) -> Iterable[bytes]: ...
def __call__(self, file: _Readable, block_size: int = ..., /) -> Iterable[bytes]: ...