diff --git a/stdlib/2/typing.pyi b/stdlib/2/typing.pyi index 85678ae8b..41d73eac2 100644 --- a/stdlib/2/typing.pyi +++ b/stdlib/2/typing.pyi @@ -63,6 +63,7 @@ _KT_co = TypeVar('_KT_co', covariant=True) # Key type covariant containers. _VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers. _T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant. _TC = TypeVar('_TC', bound=Type[object]) +_C = TypeVar("_C", bound=Callable) def runtime(cls: _TC) -> _TC: ... @@ -462,3 +463,6 @@ class NamedTuple(tuple): def _replace(self: _T, **kwargs: Any) -> _T: ... def NewType(name: str, tp: Type[_T]) -> Type[_T]: ... + +# This itself is only available during type checking +def type_check_only(func_or_cls: _C) -> _C: ... diff --git a/stdlib/3/typing.pyi b/stdlib/3/typing.pyi index 921b63ae9..8473c4796 100644 --- a/stdlib/3/typing.pyi +++ b/stdlib/3/typing.pyi @@ -65,6 +65,7 @@ _KT_co = TypeVar('_KT_co', covariant=True) # Key type covariant containers. _VT_co = TypeVar('_VT_co', covariant=True) # Value type covariant containers. _T_contra = TypeVar('_T_contra', contravariant=True) # Ditto contravariant. _TC = TypeVar('_TC', bound=Type[object]) +_C = TypeVar("_C", bound=Callable) def runtime(cls: _TC) -> _TC: ... @@ -585,3 +586,6 @@ class NamedTuple(tuple): def _replace(self: _T, **kwargs: Any) -> _T: ... def NewType(name: str, tp: Type[_T]) -> Type[_T]: ... + +# This itself is only available during type checking +def type_check_only(func_or_cls: _C) -> _C: ...