Add missing TypedDict methods and ClassVars (#8512)

This commit is contained in:
Alex Waygood
2022-08-10 10:29:40 +01:00
committed by GitHub
parent c68bcc7e69
commit 7eaedd44dd
3 changed files with 34 additions and 11 deletions

View File

@@ -173,10 +173,10 @@ Protocol: _SpecialForm = ...
Callable: _SpecialForm = ...
Type: _SpecialForm = ...
NoReturn: _SpecialForm = ...
ClassVar: _SpecialForm = ...
Optional: _SpecialForm
Tuple: _SpecialForm
ClassVar: _SpecialForm
if sys.version_info >= (3, 8):
Final: _SpecialForm
def final(f: _T) -> _T: ...
@@ -781,7 +781,13 @@ class NamedTuple(tuple[Any, ...]):
def _replace(self: TypeshedSelf, **kwargs: Any) -> TypeshedSelf: ...
# Internal mypy fallback type for all typed dicts (does not exist at runtime)
# N.B. Keep this mostly in sync with typing_extensions._TypedDict/mypy_extensions._TypedDict
@type_check_only
class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
__total__: ClassVar[bool]
if sys.version_info >= (3, 9):
__required_keys__: ClassVar[frozenset[str]]
__optional_keys__: ClassVar[frozenset[str]]
def copy(self: TypeshedSelf) -> TypeshedSelf: ...
# Using NoReturn so that only calls using mypy plugin hook that specialize the signature
# can go through.
@@ -793,8 +799,9 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
def items(self) -> ItemsView[str, object]: ...
def keys(self) -> KeysView[str]: ...
def values(self) -> ValuesView[object]: ...
def __or__(self: TypeshedSelf, __value: TypeshedSelf) -> TypeshedSelf: ...
def __ior__(self: TypeshedSelf, __value: TypeshedSelf) -> TypeshedSelf: ...
if sys.version_info >= (3, 9):
def __or__(self: TypeshedSelf, __value: TypeshedSelf) -> TypeshedSelf: ...
def __ior__(self: TypeshedSelf, __value: TypeshedSelf) -> TypeshedSelf: ...
@_final
class ForwardRef: