typing.AwaitableGenerator: add type_check_only (#8115)

This commit is contained in:
KotlinIsland
2022-06-21 14:01:09 +10:00
committed by GitHub
parent 6fd87aca20
commit 35a59f6aa7

View File

@@ -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: