@@ -5,7 +5,8 @@ import sys
5
5
# from _ast below when loaded in an unorthodox way by the Dropbox
6
6
# internal Bazel integration.
7
7
import typing as _typing
8
- from typing import Any , Iterator , Optional , Union , TypeVar
8
+ from typing import overload , Any , Iterator , Optional , Union , TypeVar
9
+ from typing_extensions import Literal
9
10
10
11
# The same unorthodox Bazel integration causes issues with sys, which
11
12
# is imported in both modules. unfortunately we can't just rename sys,
@@ -23,9 +24,18 @@ class NodeTransformer(NodeVisitor):
23
24
_T = TypeVar ('_T' , bound = AST )
24
25
25
26
if sys .version_info >= (3 , 8 ):
27
+ @overload
28
+ def parse (source : Union [str , bytes ], filename : Union [str , bytes ] = ..., mode : Literal ["exec" ] = ...,
29
+ type_comments : bool = ..., feature_version : int = ...) -> Module : ...
30
+
31
+ @overload
26
32
def parse (source : Union [str , bytes ], filename : Union [str , bytes ] = ..., mode : str = ...,
27
33
type_comments : bool = ..., feature_version : int = ...) -> AST : ...
28
34
else :
35
+ @overload
36
+ def parse (source : Union [str , bytes ], filename : Union [str , bytes ] = ..., mode : Literal ["exec" ] = ...) -> Module : ...
37
+
38
+ @overload
29
39
def parse (source : Union [str , bytes ], filename : Union [str , bytes ] = ..., mode : str = ...) -> AST : ...
30
40
31
41
def copy_location (new_node : _T , old_node : AST ) -> _T : ...
0 commit comments