@@ -18,8 +18,6 @@ class AST:
1818 _attributes : ClassVar [tuple [str , ...]]
1919 _fields : ClassVar [tuple [str , ...]]
2020 def __init__ (self , * args : Any , ** kwargs : Any ) -> None : ...
21- # TODO: Not all nodes have all of the following attributes
22- type_comment : str | None
2321
2422class mod (AST ): ...
2523class type_ignore (AST ): ...
@@ -67,6 +65,7 @@ class FunctionDef(stmt):
6765 body : list [stmt ]
6866 decorator_list : list [expr ]
6967 returns : expr | None
68+ type_comment : str | None
7069 if sys .version_info >= (3 , 12 ):
7170 type_params : list [type_param ]
7271
@@ -80,6 +79,7 @@ class AsyncFunctionDef(stmt):
8079 body : list [stmt ]
8180 decorator_list : list [expr ]
8281 returns : expr | None
82+ type_comment : str | None
8383 if sys .version_info >= (3 , 12 ):
8484 type_params : list [type_param ]
8585
@@ -111,6 +111,7 @@ class Assign(stmt):
111111 __match_args__ = ("targets" , "value" , "type_comment" )
112112 targets : list [expr ]
113113 value : expr
114+ type_comment : str | None
114115
115116class AugAssign (stmt ):
116117 if sys .version_info >= (3 , 10 ):
@@ -134,6 +135,7 @@ class For(stmt):
134135 iter : expr
135136 body : list [stmt ]
136137 orelse : list [stmt ]
138+ type_comment : str | None
137139
138140class AsyncFor (stmt ):
139141 if sys .version_info >= (3 , 10 ):
@@ -142,6 +144,7 @@ class AsyncFor(stmt):
142144 iter : expr
143145 body : list [stmt ]
144146 orelse : list [stmt ]
147+ type_comment : str | None
145148
146149class While (stmt ):
147150 if sys .version_info >= (3 , 10 ):
@@ -162,12 +165,14 @@ class With(stmt):
162165 __match_args__ = ("items" , "body" , "type_comment" )
163166 items : list [withitem ]
164167 body : list [stmt ]
168+ type_comment : str | None
165169
166170class AsyncWith (stmt ):
167171 if sys .version_info >= (3 , 10 ):
168172 __match_args__ = ("items" , "body" , "type_comment" )
169173 items : list [withitem ]
170174 body : list [stmt ]
175+ type_comment : str | None
171176
172177class Raise (stmt ):
173178 if sys .version_info >= (3 , 10 ):
@@ -506,6 +511,7 @@ class arg(AST):
506511 __match_args__ = ("arg" , "annotation" , "type_comment" )
507512 arg : _Identifier
508513 annotation : expr | None
514+ type_comment : str | None
509515
510516class keyword (AST ):
511517 lineno : int
0 commit comments