Skip to content

typing.AwaitableGenerator add type_check_only #8115

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions stdlib/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
): ...
Expand Down Expand Up @@ -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:
Expand Down