Improve .keys(), .values(), .items() methods for TypedDicts (#8532)

This commit is contained in:
Alex Waygood
2022-08-13 05:02:43 +02:00
committed by GitHub
parent 2efaa6a379
commit cf0b3a2596
3 changed files with 13 additions and 13 deletions

View File

@@ -1,7 +1,8 @@
import abc
import sys
from _collections_abc import dict_items, dict_keys, dict_values
from _typeshed import IdentityFunction, Self
from collections.abc import ItemsView, KeysView, Mapping, ValuesView
from collections.abc import Mapping
from typing import Any, ClassVar, Generic, TypeVar, overload, type_check_only
_T = TypeVar("_T")
@@ -21,9 +22,9 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
# Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
def pop(self, k: NoReturn, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse]
def update(self: Self, __m: Self) -> None: ...
def items(self) -> ItemsView[str, object]: ...
def keys(self) -> KeysView[str]: ...
def values(self) -> ValuesView[object]: ...
def items(self) -> dict_items[str, object]: ...
def keys(self) -> dict_keys[str, object]: ...
def values(self) -> dict_values[str, object]: ...
def __delitem__(self, k: NoReturn) -> None: ...
if sys.version_info >= (3, 9):
def __or__(self: Self, __other: Self) -> Self: ...