diff --git a/stdlib/3/types.pyi b/stdlib/3/types.pyi index 5e94ee8dd..1da6369f9 100644 --- a/stdlib/3/types.pyi +++ b/stdlib/3/types.pyi @@ -3,9 +3,14 @@ # TODO parts of this should be conditional on version -from typing import Any, Callable, Dict, Iterator, Optional, Tuple, TypeVar, Union, overload +from typing import ( + Any, Callable, Dict, Generic, Iterator, Mapping, Optional, Tuple, TypeVar, + Union, overload +) _T = TypeVar('_T') +_KT = TypeVar('_KT') +_VT = TypeVar('_VT') class _Cell: cell_contents = ... # type: Any @@ -57,16 +62,12 @@ class CodeType: cellvars: Tuple[str, ...] = ..., ) -> None: ... -class MappingProxyType: - def copy(self) -> dict: ... - def get(self, key: str, default: _T = ...) -> Union[Any, _T]: ... - def items(self) -> Iterator[Tuple[str, Any]]: ... - def keys(self) -> Iterator[str]: ... - def values(self) -> Iterator[Any]: ... - def __contains__(self, key: str) -> bool: ... - def __getitem__(self, key: str) -> Any: ... - def __iter__(self) -> Iterator[str]: ... +class MappingProxyType(Mapping[_KT, _VT], Generic[_KT, _VT]): + def __init__(self, mapping: Mapping[_KT, _VT]) -> None: ... + def __getitem__(self, k: _KT) -> _VT: ... + def __iter__(self) -> Iterator[_KT]: ... def __len__(self) -> int: ... + class SimpleNamespace(Any): ... class GeneratorType: