From 35a59f6aa7d31a808c8510069653294350a28091 Mon Sep 17 00:00:00 2001 From: KotlinIsland <65446343+KotlinIsland@users.noreply.github.com> Date: Tue, 21 Jun 2022 14:01:09 +1000 Subject: [PATCH] `typing.AwaitableGenerator`: add `type_check_only` (#8115) --- stdlib/typing.pyi | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 969e61952..acbce5cd3 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -115,6 +115,9 @@ if sys.version_info >= (3, 11): "reveal_type", ] +# This itself is only available during type checking +def type_check_only(func_or_cls: _F) -> _F: ... + Any = object() @_final @@ -391,6 +394,7 @@ class Coroutine(Awaitable[_V_co], Generic[_T_co, _T_contra, _V_co]): # NOTE: This type does not exist in typing.py or PEP 484 but mypy needs it to exist. # The parameters correspond to Generator, but the 4th is the original type. +@type_check_only class AwaitableGenerator( Awaitable[_V_co], Generator[_T_co, _T_contra, _V_co], Generic[_T_co, _T_contra, _V_co, _S], metaclass=ABCMeta ): ... @@ -915,9 +919,6 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta): def __or__(self: TypeshedSelf, __value: TypeshedSelf) -> TypeshedSelf: ... def __ior__(self: TypeshedSelf, __value: TypeshedSelf) -> TypeshedSelf: ... -# This itself is only available during type checking -def type_check_only(func_or_cls: _F) -> _F: ... - if sys.version_info >= (3, 7): @_final class ForwardRef: