8000 Fix Dictionary views "mapping" attribute in python 3.10 by Rohan-Salwan · Pull Request #6395 · python/typeshed · GitHub
[go: up one dir, main page]

Skip to content

Fix Dictionary views "mapping" attribute in python 3.10 #6395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
10000
Diff view
19 changes: 18 additions & 1 deletion stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ from _typeshed import (
SupportsWrite,
)
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
from types import CodeType, TracebackType
from types import CodeType, MappingProxyType, TracebackType
from typing import (
IO,
AbstractSet,
Expand All @@ -36,8 +36,10 @@ from typing import (
ByteString,
Callable,
Generic,
ItemsView,
Iterable,
Iterator,
KeysView,
Mapping,
MutableMapping,
MutableSequence,
Expand All @@ -57,6 +59,7 @@ from typing import (
Type,
TypeVar,
Union,
ValuesView,
overload,
)
from typing_extensions import Literal, SupportsIndex, TypeGuard, final
Expand All @@ -69,6 +72,8 @@ _T_co = TypeVar("_T_co", covariant=True)
_T_contra = TypeVar("_T_contra", contravariant=True)
_KT = TypeVar("_KT")
_VT = TypeVar("_VT")
_KT_co = TypeVar("_KT_co", covariant=True) # Key type covariant containers.
_VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers.
_S = TypeVar("_S")
_T1 = TypeVar("_T1")
_T2 = TypeVar("_T2")
Expand Down Expand Up @@ -813,6 +818,18 @@ class list(MutableSequence[_T], Generic[_T]):
if sys.version_info >= (3, 9):
def __class_getitem__(cls, __item: Any) -> GenericAlias: ...

class _dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]):
if sys.version_info >= (3, 10):
mapping: MappingProxyType[_KT_co, _VT_co]

class _dict_values(ValuesView[_VT_co], Generic[_VT_co, _KT_co]):
if sys.version_info >= (3, 10):
mapping: MappingProxyType[_KT_co, _VT_co]

class _dict_items(ItemsView[_KT_co, _VT_co], Generic[_KT_co, _VT_co]):
if sys.version_info >= (3, 10):
mapping: MappingProxyType[_KT_co, _VT_co]

class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
@overload
def __init__(self: dict[_KT, _VT]) -> None: ...
Expand Down
0