@@ -167,18 +167,66 @@ if sys.version_info >= (3, 8):
167
167
@overload
168
168
def parse (
169
169
source : str | bytes ,
170
- filename : str | bytes = ...,
171
- mode : str = ...,
170
+ filename : str | bytes ,
171
+ mode : Literal ["eval" ],
172
+ * ,
173
+ type_comments : bool = ...,
174
+ feature_version : None | int | _typing .Tuple [int , int ] = ...,
175
+ ) -> Expression : ...
176
+ @overload
177
+ def parse (
178
+ source : str | bytes ,
179
+ filename : str | bytes ,
180
+ mode : Literal ["func_type" ],
181
+ * ,
182
+ type_comments : bool = ...,
183
+ feature_version : None | int | _typing .Tuple [int , int ] = ...,
184
+ ) -> FunctionType : ...
185
+ @overload
186
+ def parse (
187
+ source : str | bytes ,
188
+ filename : str | bytes ,
189
+ mode : Literal ["single" ],
190
+ * ,
191
+ type_comments : bool = ...,
192
+ feature_version : None | int | _typing .Tuple [int , int ] = ...,
193
+ ) -> Interactive : ...
194
+ @overload
195
+ def parse (
196
+ source : str | bytes ,
172
197
* ,
198
+ mode : Literal ["eval" ],
173
199
type_comments : bool = ...,
174
200
feature_version : None | int | _typing .Tuple [int , int ] = ...,
175
- ) -> AST : ...
201
+ ) -> Expression : ...
202
+ @overload
203
+ def parse (
204
+ source : str | bytes ,
205
+ * ,
206
+ mode : Literal ["func_type" ],
207
+ type_comments : bool = ...,
208
+ feature_version : None | int | _typing .Tuple [int , int ] = ...,
209
+ ) -> FunctionType : ...
210
+ @overload
211
+ def parse (
212
+ source : str | bytes ,
213
+ * ,
214
+ mode : Literal ["single" ],
215
+ type_comments : bool = ...,
216
+ feature_version : None | int | _typing .Tuple [int , int ] = ...,
217
+ ) -> Interactive : ...
176
218
177
219
else :
178
220
@overload
179
221
def parse (source : str | bytes , filename : str | bytes = ..., mode : Literal ["exec" ] = ...) -> Module : ...
180
222
@overload
181
- def parse (source : str | bytes , filename : str | bytes = ..., mode : str = ...) -> AST : ...
223
+ def parse (source : str | bytes , filename : str | bytes , mode : Literal ["eval" ]) -> Expression : ...
224
+ @overload
225
+ def parse (source : str | bytes , filename : str | bytes , mode : Literal ["single" ]) -> Interactive : ...
226
+ @overload
227
+ def parse (source : str | bytes , * , mode : Literal ["eval" ]) -> Expression : ...
228
+ @overload
229
+ def parse (source : str | bytes , * , mode : Literal ["single" ]) -> Interactive : ...
182
230
183
231
if sys .version_info >= (3 , 9 ):
184
232
def unparse (ast_obj : AST ) -> str : ...
0 commit comments