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,9 +1,9 @@
from _typeshed import SupportsRead, SupportsWrite
from typing import Any, AnyStr, Callable, Iterable, List, Sequence, Set, Text, Tuple, Type, TypeVar, Union
from typing import Any, AnyStr, Callable, Iterable, Sequence, Text, TypeVar, Union
_AnyStr = TypeVar("_AnyStr", str, unicode)
_AnyPath = TypeVar("_AnyPath", str, unicode)
_PathReturn = Type[None]
_PathReturn = type[None]
class Error(EnvironmentError): ...
class SpecialFileError(EnvironmentError): ...
@@ -15,9 +15,9 @@ def copymode(src: Text, dst: Text) -> None: ...
def copystat(src: Text, dst: Text) -> None: ...
def copy(src: Text, dst: Text) -> _PathReturn: ...
def copy2(src: Text, dst: Text) -> _PathReturn: ...
def ignore_patterns(*patterns: Text) -> Callable[[Any, List[_AnyStr]], Set[_AnyStr]]: ...
def ignore_patterns(*patterns: Text) -> Callable[[Any, list[_AnyStr]], set[_AnyStr]]: ...
def copytree(
src: AnyStr, dst: AnyStr, symlinks: bool = ..., ignore: None | Callable[[AnyStr, List[AnyStr]], Iterable[AnyStr]] = ...
src: AnyStr, dst: AnyStr, symlinks: bool = ..., ignore: None | Callable[[AnyStr, list[AnyStr]], Iterable[AnyStr]] = ...
) -> _PathReturn: ...
def rmtree(path: _AnyPath, ignore_errors: bool = ..., onerror: Callable[[Any, _AnyPath, Any], Any] | None = ...) -> None: ...
@@ -35,11 +35,11 @@ def make_archive(
group: str | None = ...,
logger: Any | None = ...,
) -> _AnyStr: ...
def get_archive_formats() -> List[Tuple[str, str]]: ...
def get_archive_formats() -> list[tuple[str, str]]: ...
def register_archive_format(
name: str,
function: Callable[..., Any],
extra_args: Sequence[Tuple[str, Any] | List[Any]] | None = ...,
extra_args: Sequence[tuple[str, Any] | list[Any]] | None = ...,
description: str = ...,
) -> None: ...
def unregister_archive_format(name: str) -> None: ...