@@ -2,7 +2,23 @@ import sys
22import typing
33from importlib .abc import _LoaderProtocol
44from importlib .machinery import ModuleSpec
5- from typing import Any , Awaitable , Callable , Dict , Generic , Iterable , Iterator , Mapping , Optional , Tuple , Type , TypeVar , overload
5+ from typing import (
6+ Any ,
7+ AsyncGenerator ,
8+ Awaitable ,
9+ Callable ,
10+ Dict ,
11+ Generator ,
12+ Generic ,
13+ Iterable ,
14+ Iterator ,
15+ Mapping ,
16+ Optional ,
17+ Tuple ,
18+ Type ,
19+ TypeVar ,
20+ overload ,
21+ )
622from typing_extensions import Literal , final
723
824# Note, all classes "defined" here require special handling.
@@ -12,6 +28,7 @@ _T_co = TypeVar("_T_co", covariant=True)
1228_T_contra = TypeVar ("_T_contra" , contravariant = True )
1329_KT = TypeVar ("_KT" )
1430_VT = TypeVar ("_VT" )
31+ _V_co = TypeVar ("_V_co" , covariant = True )
1532
1633class _Cell :
1734 cell_contents : Any
@@ -142,28 +159,28 @@ class ModuleType:
142159 __spec__ : Optional [ModuleSpec ]
143160 def __init__ (self , name : str , doc : Optional [str ] = ...) -> None : ...
144161
145- class GeneratorType :
162+ class GeneratorType ( Generator [ _T_co , _T_contra , _V_co ]) :
146163 gi_code : CodeType
147164 gi_frame : FrameType
148165 gi_running : bool
149- gi_yieldfrom : Optional [GeneratorType ]
150- def __iter__ (self ) -> GeneratorType : ...
151- def __next__ (self ) -> Any : ...
166+ gi_yieldfrom : Optional [GeneratorType [ _T_co , _T_contra , Any ] ]
167+ def __iter__ (self ) -> GeneratorType [ _T_co , _T_contra , _V_co ] : ...
168+ def __next__ (self ) -> _T_co : ...
152169 def close (self ) -> None : ...
153- def send (self , __arg : Any ) -> Any : ...
170+ def send (self , __arg : _T_contra ) -> _T_co : ...
154171 @overload
155172 def throw (
156173 self , __typ : Type [BaseException ], __val : typing .Union [BaseException , object ] = ..., __tb : Optional [TracebackType ] = ...
157- ) -> Any : ...
174+ ) -> _T_co : ...
158175 @overload
159- def throw (self , __typ : BaseException , __val : None = ..., __tb : Optional [TracebackType ] = ...) -> Any : ...
176+ def throw (self , __typ : BaseException , __val : None = ..., __tb : Optional [TracebackType ] = ...) -> _T_co : ...
160177
161- class AsyncGeneratorType (Generic [_T_co , _T_contra ]):
178+ class AsyncGeneratorType (AsyncGenerator [_T_co , _T_contra ]):
162179 ag_await : Optional [Awaitable [Any ]]
163180 ag_frame : FrameType
164181 ag_running : bool
165182 ag_code : CodeType
166- def __aiter__ (self ) -> Awaitable [ AsyncGeneratorType [_T_co , _T_contra ] ]: ...
183+ def __aiter__ (self ) -> AsyncGeneratorType [_T_co , _T_contra ]: ...
167184 def __anext__ (self ) -> Awaitable [_T_co ]: ...
168185 def asend (self , __val : _T_contra ) -> Awaitable [_T_co ]: ...
169186 @overload
0 commit comments