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,6 +1,6 @@
import io
from types import TracebackType
from typing import IO, Callable, Dict, Iterable, Iterator, List, Mapping, Text, Tuple, Type
from typing import IO, Callable, Iterable, Iterator, Mapping, Text
# tar constants
NUL: bytes
@@ -38,11 +38,11 @@ DEFAULT_FORMAT: int
# tarfile constants
SUPPORTED_TYPES: Tuple[bytes, ...]
REGULAR_TYPES: Tuple[bytes, ...]
GNU_TYPES: Tuple[bytes, ...]
PAX_FIELDS: Tuple[str, ...]
PAX_NUMBER_FIELDS: Dict[str, type]
SUPPORTED_TYPES: tuple[bytes, ...]
REGULAR_TYPES: tuple[bytes, ...]
GNU_TYPES: tuple[bytes, ...]
PAX_FIELDS: tuple[str, ...]
PAX_NUMBER_FIELDS: dict[str, type]
ENCODING: str
@@ -56,7 +56,7 @@ def open(
bufsize: int = ...,
*,
format: int | None = ...,
tarinfo: Type[TarInfo] | None = ...,
tarinfo: type[TarInfo] | None = ...,
dereference: bool | None = ...,
ignore_zeros: bool | None = ...,
encoding: str | None = ...,
@@ -76,12 +76,12 @@ class TarFile(Iterable[TarInfo]):
mode: str
fileobj: IO[bytes] | None
format: int | None
tarinfo: Type[TarInfo]
tarinfo: type[TarInfo]
dereference: bool | None
ignore_zeros: bool | None
encoding: str | None
errors: str
fileobject: Type[ExFileObject]
fileobject: type[ExFileObject]
pax_headers: Mapping[str, str] | None
debug: int | None
errorlevel: int | None
@@ -93,7 +93,7 @@ class TarFile(Iterable[TarInfo]):
mode: str = ...,
fileobj: IO[bytes] | None = ...,
format: int | None = ...,
tarinfo: Type[TarInfo] | None = ...,
tarinfo: type[TarInfo] | None = ...,
dereference: bool | None = ...,
ignore_zeros: bool | None = ...,
encoding: str | None = ...,
@@ -105,7 +105,7 @@ class TarFile(Iterable[TarInfo]):
) -> None: ...
def __enter__(self) -> TarFile: ...
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 __iter__(self) -> Iterator[TarInfo]: ...
@classmethod
@@ -117,7 +117,7 @@ class TarFile(Iterable[TarInfo]):
bufsize: int = ...,
*,
format: int | None = ...,
tarinfo: Type[TarInfo] | None = ...,
tarinfo: type[TarInfo] | None = ...,
dereference: bool | None = ...,
ignore_zeros: bool | None = ...,
encoding: str | None = ...,
@@ -135,7 +135,7 @@ class TarFile(Iterable[TarInfo]):
*,
compresslevel: int = ...,
format: int | None = ...,
tarinfo: Type[TarInfo] | None = ...,
tarinfo: type[TarInfo] | None = ...,
dereference: bool | None = ...,
ignore_zeros: bool | None = ...,
encoding: str | None = ...,
@@ -152,7 +152,7 @@ class TarFile(Iterable[TarInfo]):
compresslevel: int = ...,
*,
format: int | None = ...,
tarinfo: Type[TarInfo] | None = ...,
tarinfo: type[TarInfo] | None = ...,
dereference: bool | None = ...,
ignore_zeros: bool | None = ...,
encoding: str | None = ...,
@@ -169,7 +169,7 @@ class TarFile(Iterable[TarInfo]):
compresslevel: int = ...,
*,
format: int | None = ...,
tarinfo: Type[TarInfo] | None = ...,
tarinfo: type[TarInfo] | None = ...,
dereference: bool | None = ...,
ignore_zeros: bool | None = ...,
encoding: str | None = ...,
@@ -186,7 +186,7 @@ class TarFile(Iterable[TarInfo]):
preset: int | None = ...,
*,
format: int | None = ...,
tarinfo: Type[TarInfo] | None = ...,
tarinfo: type[TarInfo] | None = ...,
dereference: bool | None = ...,
ignore_zeros: bool | None = ...,
encoding: str | None = ...,
@@ -195,8 +195,8 @@ class TarFile(Iterable[TarInfo]):
errorlevel: int | None = ...,
) -> TarFile: ...
def getmember(self, name: str) -> TarInfo: ...
def getmembers(self) -> List[TarInfo]: ...
def getnames(self) -> List[str]: ...
def getmembers(self) -> list[TarInfo]: ...
def getnames(self) -> list[str]: ...
def list(self, verbose: bool = ...) -> None: ...
def next(self) -> TarInfo | None: ...
def extractall(self, path: Text = ..., members: Iterable[TarInfo] | None = ...) -> None: ...