Use PEP 585 syntax in Python 2, protobuf & _ast stubs, where possible (#6949)

This commit is contained in:
Alex Waygood
2022-01-18 15:14:03 +00:00
committed by GitHub
parent aa885ecd65
commit 8af5e0d340
264 changed files with 2217 additions and 2411 deletions

View File

@@ -1,10 +1,10 @@
import io
from _typeshed import StrPath
from types import TracebackType
from typing import IO, Any, Callable, Dict, Iterable, List, Pattern, Protocol, Sequence, Text, Tuple, Type, Union
from typing import IO, Any, Callable, Iterable, Pattern, Protocol, Sequence, Text, Union
_SZI = Union[Text, ZipInfo]
_DT = Tuple[int, int, int, int, int, int]
_DT = tuple[int, int, int, int, int, int]
class BadZipfile(Exception): ...
@@ -18,7 +18,7 @@ class ZipExtFile(io.BufferedIOBase):
PATTERN: Pattern[str] = ...
newlines: List[bytes] | None
newlines: list[bytes] | None
mode: str
name: str
def __init__(
@@ -42,19 +42,19 @@ class ZipFile:
filename: Text | None
debug: int
comment: bytes
filelist: List[ZipInfo]
filelist: list[ZipInfo]
fp: IO[bytes] | None
NameToInfo: Dict[Text, ZipInfo]
NameToInfo: dict[Text, ZipInfo]
start_dir: int # undocumented
def __init__(self, file: StrPath | IO[bytes], mode: Text = ..., compression: int = ..., allowZip64: bool = ...) -> None: ...
def __enter__(self) -> ZipFile: ...
def __exit__(
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
def close(self) -> None: ...
def getinfo(self, name: Text) -> ZipInfo: ...
def infolist(self) -> List[ZipInfo]: ...
def namelist(self) -> List[Text]: ...
def infolist(self) -> list[ZipInfo]: ...
def namelist(self) -> list[Text]: ...
def open(self, name: _SZI, mode: Text = ..., pwd: bytes | None = ..., *, force_zip64: bool = ...) -> IO[bytes]: ...
def extract(self, member: _SZI, path: StrPath | None = ..., pwd: bytes | None = ...) -> str: ...
def extractall(self, path: StrPath | None = ..., members: Iterable[Text] | None = ..., pwd: bytes | None = ...) -> None: ...