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,5 +1,5 @@
from _weakrefset import WeakSet as WeakSet
from typing import Any, Callable, Generic, Iterable, Iterator, List, Mapping, MutableMapping, Tuple, Type, TypeVar, overload
from typing import Any, Callable, Generic, Iterable, Iterator, Mapping, MutableMapping, TypeVar, overload
from _weakref import (
CallableProxyType as CallableProxyType,
@@ -16,13 +16,13 @@ _T = TypeVar("_T")
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
ProxyTypes: Tuple[Type[Any], ...]
ProxyTypes: tuple[type[Any], ...]
class WeakValueDictionary(MutableMapping[_KT, _VT]):
@overload
def __init__(self) -> None: ...
@overload
def __init__(self, __other: Mapping[_KT, _VT] | Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
def __init__(self, __other: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
def __len__(self) -> int: ...
def __getitem__(self, k: _KT) -> _VT: ...
def __setitem__(self, k: _KT, v: _VT) -> None: ...
@@ -32,14 +32,14 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
def __iter__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
def copy(self) -> WeakValueDictionary[_KT, _VT]: ...
def keys(self) -> List[_KT]: ...
def values(self) -> List[_VT]: ...
def items(self) -> List[Tuple[_KT, _VT]]: ...
def keys(self) -> list[_KT]: ...
def values(self) -> list[_VT]: ...
def items(self) -> list[tuple[_KT, _VT]]: ...
def iterkeys(self) -> Iterator[_KT]: ...
def itervalues(self) -> Iterator[_VT]: ...
def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
def iteritems(self) -> Iterator[tuple[_KT, _VT]]: ...
def itervaluerefs(self) -> Iterator[KeyedRef[_KT, _VT]]: ...
def valuerefs(self) -> List[KeyedRef[_KT, _VT]]: ...
def valuerefs(self) -> list[KeyedRef[_KT, _VT]]: ...
class KeyedRef(ref[_T], Generic[_KT, _T]):
key: _KT
@@ -51,7 +51,7 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]):
@overload
def __init__(self, dict: None = ...) -> None: ...
@overload
def __init__(self, dict: Mapping[_KT, _VT] | Iterable[Tuple[_KT, _VT]]) -> None: ...
def __init__(self, dict: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]]) -> None: ...
def __len__(self) -> int: ...
def __getitem__(self, k: _KT) -> _VT: ...
def __setitem__(self, k: _KT, v: _VT) -> None: ...
@@ -61,11 +61,11 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]):
def __iter__(self) -> Iterator[_KT]: ...
def __str__(self) -> str: ...
def copy(self) -> WeakKeyDictionary[_KT, _VT]: ...
def keys(self) -> List[_KT]: ...
def values(self) -> List[_VT]: ...
def items(self) -> List[Tuple[_KT, _VT]]: ...
def keys(self) -> list[_KT]: ...
def values(self) -> list[_VT]: ...
def items(self) -> list[tuple[_KT, _VT]]: ...
def iterkeys(self) -> Iterator[_KT]: ...
def itervalues(self) -> Iterator[_VT]: ...
def iteritems(self) -> Iterator[Tuple[_KT, _VT]]: ...
def iteritems(self) -> Iterator[tuple[_KT, _VT]]: ...
def iterkeyrefs(self) -> Iterator[ref[_KT]]: ...
def keyrefs(self) -> List[ref[_KT]]: ...
def keyrefs(self) -> list[ref[_KT]]: ...