@@ -10,16 +10,32 @@ class AST:
10
10
_attributes : ClassVar [typing .Tuple [str , ...]]
11
11
_fields : ClassVar [typing .Tuple [str , ...]]
12
12
def __init__ (self , * args : Any , ** kwargs : Any ) -> None : ...
13
+ # TODO: Not all nodes have all of the following attributes
13
14
lineno : int
14
15
col_offset : int
16
+ if sys .version_info >= (3 , 8 ):
17
+ end_lineno : Optional [int ]
18
+ end_col_offset : Optional [int ]
19
+ type_comment : Optional [str ]
15
20
16
21
class mod (AST ):
17
22
...
18
23
24
+ if sys .version_info >= (3 , 8 ):
25
+ class type_ignore (AST ): ...
26
+
27
+ class TypeIgnore (type_ignore ): ...
28
+
29
+ class FunctionType (mod ):
30
+ argtypes : typing .List [expr ]
31
+ returns : expr
32
+
19
33
class Module (mod ):
20
34
body = ... # type: typing.List[stmt]
21
35
if sys .version_info >= (3 , 7 ):
22
36
docstring : Optional [str ]
37
+ if sys .version_info >= (3 , 8 ):
38
+ type_ignores : typing .List [TypeIgnore ]
23
39
24
40
class Interactive (mod ):
25
41
body = ... # type: typing.List[stmt]
@@ -232,10 +248,10 @@ class Call(expr):
232
248
args = ... # type: typing.List[expr]
233
249
keywords = ... # type: typing.List[keyword]
234
250
235
- class Num (expr ):
236
- n = ... # type: float
251
+ class Num (expr ): # Deprecated in 3.8; use Constant
252
+ n = ... # type: complex
237
253
238
- class Str (expr ):
254
+ class Str (expr ): # Deprecated in 3.8; use Constant
239
255
s = ... # type: str
240
256
241
257
if sys .version_info >= (3 , 6 ):
@@ -247,12 +263,24 @@ if sys.version_info >= (3, 6):
247
263
class JoinedStr (expr ):
248
264
values = ... # type: typing.List[expr]
249
265
250
- class Bytes (expr ):
266
+ class Bytes (expr ): # Deprecated in 3.8; use Constant
251
267
s = ... # type: bytes
252
268
253
269
class NameConstant (expr ):
254
270
value = ... # type: Any
255
271
272
+ if sys .version_info >= (3 , 8 ):
273
+ class Constant (expr ):
274
+ value : Any # None, str, bytes, bool, int, float, complex, Ellipsis
275
+ kind : Optional [str ]
276
+ # Aliases for value, for backwards compatibility
277
+ s : Any
278
+ n : complex
279
+
280
+ class NamedExpr (expr ):
281
+ target : expr
282
+ value : expr
283
+
256
284
class Ellipsis (expr ): ...
257
285
258
286
class Attribute (expr ):
0 commit comments