@@ -18,8 +18,6 @@ class AST:
18
18
_attributes : ClassVar [tuple [str , ...]]
19
19
_fields : ClassVar [tuple [str , ...]]
20
20
def __init__ (self , * args : Any , ** kwargs : Any ) -> None : ...
21
- # TODO: Not all nodes have all of the following attributes
22
- type_comment : str | None
23
21
24
22
class mod (AST ): ...
25
23
class type_ignore (AST ): ...
@@ -67,6 +65,7 @@ class FunctionDef(stmt):
67
65
body : list [stmt ]
68
66
decorator_list : list [expr ]
69
67
returns : expr | None
68
+ type_comment : str | None
70
69
if sys .version_info >= (3 , 12 ):
71
70
type_params : list [type_param ]
72
71
@@ -80,6 +79,7 @@ class AsyncFunctionDef(stmt):
80
79
body : list [stmt ]
81
80
decorator_list : list [expr ]
82
81
returns : expr | None
82
+ type_comment : str | None
83
83
if sys .version_info >= (3 , 12 ):
84
84
type_params : list [type_param ]
85
85
@@ -111,6 +111,7 @@ class Assign(stmt):
111
111
__match_args__ = ("targets" , "value" , "type_comment" )
112
112
targets : list [expr ]
113
113
value : expr
114
+ type_comment : str | None
114
115
115
116
class AugAssign (stmt ):
116
117
if sys .version_info >= (3 , 10 ):
@@ -134,6 +135,7 @@ class For(stmt):
134
135
iter : expr
135
136
body : list [stmt ]
136
137
orelse : list [stmt ]
138
+ type_comment : str | None
137
139
138
140
class AsyncFor (stmt ):
139
141
if sys .version_info >= (3 , 10 ):
@@ -142,6 +144,7 @@ class AsyncFor(stmt):
142
144
iter : expr
143
145
body : list [stmt ]
144
146
orelse : list [stmt ]
147
+ type_comment : str | None
145
148
146
149
class While (stmt ):
147
150
if sys .version_info >= (3 , 10 ):
@@ -162,12 +165,14 @@ class With(stmt):
162
165
__match_args__ = ("items" , "body" , "type_comment" )
163
166
items : list [withitem ]
164
167
body : list [stmt ]
168
+ type_comment : str | None
165
169
166
170
class AsyncWith (stmt ):
167
171
if sys .version_info >= (3 , 10 ):
168
172
__match_args__ = ("items" , "body" , "type_comment" )
169
173
items : list [withitem ]
170
174
body : list [stmt ]
175
+ type_comment : str | None
171
176
172
177
class Raise (stmt ):
173
178
if sys .version_info >= (3 , 10 ):
@@ -506,6 +511,7 @@ class arg(AST):
506
511
__match_args__ = ("arg" , "annotation" , "type_comment" )
507
512
arg : _Identifier
508
513
annotation : expr | None
514
+ type_comment : str | None
509
515
510
516
class keyword (AST ):
511
517
lineno : int
0 commit comments