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,11 +1,11 @@
from typing import Any, Container, Dict, Generic, Iterable, Iterator, List, Mapping, Sized, Tuple, TypeVar, overload
from typing import Any, Container, Generic, Iterable, Iterator, Mapping, Sized, TypeVar, overload
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
_T = TypeVar("_T")
class UserDict(Dict[_KT, _VT], Generic[_KT, _VT]):
data: Dict[_KT, _VT]
class UserDict(dict[_KT, _VT], Generic[_KT, _VT]):
data: dict[_KT, _VT]
def __init__(self, initialdata: Mapping[_KT, _VT] = ...) -> None: ...
# TODO: __iter__ is not available for UserDict
@@ -21,18 +21,18 @@ class DictMixin(Iterable[_KT], Container[_KT], Sized, Generic[_KT, _VT]):
def get(self, k: _KT) -> _VT | None: ...
@overload
def get(self, k: _KT, default: _VT | _T) -> _VT | _T: ...
def values(self) -> List[_VT]: ...
def items(self) -> List[Tuple[_KT, _VT]]: ...
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 __contains__(self, o: Any) -> bool: ...
# From typing.MutableMapping[_KT, _VT]
def clear(self) -> None: ...
def pop(self, k: _KT, default: _VT = ...) -> _VT: ...
def popitem(self) -> Tuple[_KT, _VT]: ...
def popitem(self) -> tuple[_KT, _VT]: ...
def setdefault(self, k: _KT, default: _VT = ...) -> _VT: ...
@overload
def update(self, m: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
@overload
def update(self, m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
def update(self, m: Iterable[tuple[_KT, _VT]], **kwargs: _VT) -> None: ...