Make collections.abcs more consistent with runtime implementation (#10816)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This commit is contained in:
James Hilton-Balfe
2024-12-28 05:31:59 +00:00
committed by GitHub
parent d2ca658a69
commit ab75b691c2
5 changed files with 25 additions and 67 deletions

View File

@@ -374,6 +374,12 @@ _ReturnT_co = TypeVar("_ReturnT_co", covariant=True)
@final
class GeneratorType(Generator[_YieldT_co, _SendT_contra, _ReturnT_co]):
@property
def gi_code(self) -> CodeType: ...
@property
def gi_frame(self) -> FrameType: ...
@property
def gi_running(self) -> bool: ...
@property
def gi_yieldfrom(self) -> GeneratorType[_YieldT_co, _SendT_contra, Any] | None: ...
if sys.version_info >= (3, 11):
@@ -397,6 +403,12 @@ class GeneratorType(Generator[_YieldT_co, _SendT_contra, _ReturnT_co]):
class AsyncGeneratorType(AsyncGenerator[_YieldT_co, _SendT_contra]):
@property
def ag_await(self) -> Awaitable[Any] | None: ...
@property
def ag_code(self) -> CodeType: ...
@property
def ag_frame(self) -> FrameType: ...
@property
def ag_running(self) -> bool: ...
__name__: str
__qualname__: str
if sys.version_info >= (3, 12):
@@ -421,6 +433,14 @@ class CoroutineType(Coroutine[_YieldT_co, _SendT_contra, _ReturnT_co]):
__name__: str
__qualname__: str
@property
def cr_await(self) -> Any | None: ...
@property
def cr_code(self) -> CodeType: ...
@property
def cr_frame(self) -> FrameType: ...
@property
def cr_running(self) -> bool: ...
@property
def cr_origin(self) -> tuple[tuple[str, int, str], ...] | None: ...
if sys.version_info >= (3, 11):
@property