diff --git a/stdlib/collections/__init__.pyi b/stdlib/collections/__init__.pyi index a667955db27b..c7633fcdd57a 100644 --- a/stdlib/collections/__init__.pyi +++ b/stdlib/collections/__init__.pyi @@ -1,9 +1,22 @@ import sys -import typing from typing import Any, Dict, Generic, List, Optional, Tuple, Type, TypeVar, Union, overload if sys.version_info < (3, 10): from _collections_abc import * +else: + from typing import ( + Callable, + ItemsView, + Iterable, + Iterator, + KeysView, + Mapping, + MutableMapping, + MutableSequence, + Reversible, + Sequence, + ValuesView, + ) _S = TypeVar("_S") _T = TypeVar("_T") @@ -103,7 +116,7 @@ class UserString(Sequence[str]): def center(self: _UserStringT, width: int, *args: Any) -> _UserStringT: ... def count(self, sub: Union[str, UserString], start: int = ..., end: int = ...) -> int: ... if sys.version_info >= (3, 8): - def encode(self: _UserStringT, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> bytes: ... + def encode(self: UserString, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> bytes: ... else: def encode(self: _UserStringT, encoding: Optional[str] = ..., errors: Optional[str] = ...) -> _UserStringT: ... def endswith(self, suffix: Union[str, Tuple[str, ...]], start: Optional[int] = ..., end: Optional[int] = ...) -> bool: ... @@ -281,9 +294,9 @@ class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]): def __init__(self, *maps: Mapping[_KT, _VT]) -> None: ... @property def maps(self) -> List[Mapping[_KT, _VT]]: ... - def new_child(self, m: Mapping[_KT, _VT] = ...) -> typing.ChainMap[_KT, _VT]: ... + def new_child(self, m: Mapping[_KT, _VT] = ...) -> ChainMap[_KT, _VT]: ... @property - def parents(self) -> typing.ChainMap[_KT, _VT]: ... + def parents(self) -> ChainMap[_KT, _VT]: ... def __setitem__(self, k: _KT, v: _VT) -> None: ... def __delitem__(self, v: _KT) -> None: ... def __getitem__(self, k: _KT) -> _VT: ...