8000 add dict.{keys,values,items}().mapping · python/typeshed@1ec6758 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1ec6758

Browse files
committed
add dict.{keys,values,items}().mapping
1 parent e4c2c0f commit 1ec6758

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

stdlib/builtins.pyi

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ from _typeshed import (
2121
)
2222
from ast import AST, mod
2323
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
24-
from types import CodeType, TracebackType
24+
from types import CodeType, MappingProxyType, TracebackType
2525
from typing import (
2626
IO,
2727
AbstractSet,
@@ -787,6 +787,18 @@ class list(MutableSequence[_T], Generic[_T]):
787787
if sys.version_info >= (3, 9):
788788
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
789789

790+
class _dict_keys(KeysView[_KT], Generic[_KT, _VT]):
791+
if sys.version_info >= (3, 10):
792+
mapping: MappingProxyType[_KT, _VT]
793+
794+
class _dict_values(ValuesView[_VT], Generic[_KT, _VT]):
795+
if sys.version_info >= (3, 10):
796+
mapping: MappingProxyType[_KT, _VT]
797+
798+
class _dict_items(ItemsView[_KT, _VT], Generic[_KT, _VT]):
799+
if sys.version_info >= (3, 10):
800+
mapping: MappingProxyType[_KT, _VT]
801+
790802
class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
791803
@overload
792804
def __init__(self: dict[_KT, _VT]) -> None: ...
@@ -807,9 +819,9 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
807819
def update(self, __m: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
808820
@overload
809821
def update(self, **kwargs: _VT) -> None: ...
810-
def keys(self) -> KeysView[_KT]: ...
811-
def values(self) -> ValuesView[_VT]: ...
812-
def items(self) -> ItemsView[_KT, _VT]: ...
822+
def keys(self) -> _dict_keys[_KT, _VT]: ...
823+
def values(self) -> _dict_values[_KT, _VT]: ...
824+
def items(self) -> _dict_items[_KT, _VT]: ...
813825
@classmethod
814826
@overload
815827
def fromkeys(cls, __iterable: Iterable[_T], __value: None = ...) -> dict[_T, Any | None]: ...

0 commit comments

Comments
 (0)
0