diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 7f168a919..e96c10dbe 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -56,9 +56,24 @@ if sys.version_info < (3, 7): class GenericMeta(type): ... if sys.version_info >= (3, 10): + class ParamSpecArgs: + __origin__: ParamSpec + def __init__(self, origin: ParamSpec) -> None: ... + class ParamSpecKwargs: + __origin__: ParamSpec + def __init__(self, origin: ParamSpec) -> None: ... class ParamSpec: __name__: str - def __init__(self, name: str) -> None: ... + __bound__: Optional[Type[Any]] + __covariant__: bool + __contravariant__: bool + def __init__( + self, name: str, bound: Union[None, Type[Any], str] = ..., contravariant: bool = ..., covariant: bool = ... + ) -> None: ... + @property + def args(self) -> ParamSpecArgs: ... + @property + def kwargs(self) -> ParamSpecKwargs: ... Concatenate: _SpecialForm = ... TypeAlias: _SpecialForm = ... TypeGuard: _SpecialForm = ... @@ -681,3 +696,6 @@ if sys.version_info >= (3, 7): def __eq__(self, other: Any) -> bool: ... def __hash__(self) -> int: ... def __repr__(self) -> str: ... + +if sys.version_info >= (3, 10): + def is_typeddict(tp: Any) -> bool: ... diff --git a/stdlib/typing_extensions.pyi b/stdlib/typing_extensions.pyi index 8dd41b539..54c532562 100644 --- a/stdlib/typing_extensions.pyi +++ b/stdlib/typing_extensions.pyi @@ -20,6 +20,7 @@ from typing import ( Tuple, Type as Type, TypeVar, + Union, ValuesView, overload as overload, ) @@ -96,9 +97,6 @@ if sys.version_info >= (3, 7): Annotated: _SpecialForm = ... _AnnotatedAlias: Any = ... # undocumented -# TypeAlias is a (non-subscriptable) special form. -class TypeAlias: ... - @runtime_checkable class SupportsIndex(Protocol, metaclass=abc.ABCMeta): @abc.abstractmethod @@ -106,12 +104,26 @@ class SupportsIndex(Protocol, metaclass=abc.ABCMeta): # PEP 612 support for Python < 3.9 if sys.version_info >= (3, 10): - from typing import Concatenate as Concatenate, ParamSpec as ParamSpec + from typing import Concatenate as Concatenate, ParamSpec as ParamSpec, TypeAlias as TypeAlias, TypeGuard as TypeGuard else: + class ParamSpecArgs: + __origin__: ParamSpec + def __init__(self, origin: ParamSpec) -> None: ... + class ParamSpecKwargs: + __origin__: ParamSpec + def __init__(self, origin: ParamSpec) -> None: ... class ParamSpec: __name__: str - def __init__(self, name: str) -> None: ... + __bound__: Optional[Type[Any]] + __covariant__: bool + __contravariant__: bool + def __init__( + self, name: str, bound: Union[None, Type[Any], str] = ..., contravariant: bool = ..., covariant: bool = ... + ) -> None: ... + @property + def args(self) -> ParamSpecArgs: ... + @property + def kwargs(self) -> ParamSpecKwargs: ... Concatenate: _SpecialForm = ... - -# PEP 647 -TypeGuard: _SpecialForm = ... + TypeAlias: _SpecialForm = ... + TypeGuard: _SpecialForm = ...