Skip to content

Commit 35a59f6

Browse files
authored
typing.AwaitableGenerator: add type_check_only (#8115)
1 parent 6fd87ac commit 35a59f6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

stdlib/typing.pyi

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ if sys.version_info >= (3, 11):
115115
"reveal_type",
116116
]
117117

118+
# This itself is only available during type checking
119+
def type_check_only(func_or_cls: _F) -> _F: ...
120+
118121
Any = object()
119122

120123
@_final
@@ -391,6 +394,7 @@ class Coroutine(Awaitable[_V_co], Generic[_T_co, _T_contra, _V_co]):
391394

392395
# NOTE: This type does not exist in typing.py or PEP 484 but mypy needs it to exist.
393396
# The parameters correspond to Generator, but the 4th is the original type.
397+
@type_check_only
394398
class AwaitableGenerator(
395399
Awaitable[_V_co], Generator[_T_co, _T_contra, _V_co], Generic[_T_co, _T_contra, _V_co, _S], metaclass=ABCMeta
396400
): ...
@@ -915,9 +919,6 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
915919
def __or__(self: TypeshedSelf, __value: TypeshedSelf) -> TypeshedSelf: ...
916920
def __ior__(self: TypeshedSelf, __value: TypeshedSelf) -> TypeshedSelf: ...
917921

918-
# This itself is only available during type checking
919-
def type_check_only(func_or_cls: _F) -> _F: ...
920-
921922
if sys.version_info >= (3, 7):
922923
@_final
923924
class ForwardRef:

0 commit comments

Comments
 (0)