Skip to content

Commit 75a2e8e

Browse files
authored
Update _ast.pyi
improvement: shift `type_comment` attribute to classes which contain it
1 parent d5e0838 commit 75a2e8e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

stdlib/_ast.pyi

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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

2422
class mod(AST): ...
2523
class 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

115116
class 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

138140
class 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

146149
class 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

166170
class 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

172177
class 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

510516
class keyword(AST):
511517
lineno: int

0 commit comments

Comments
 (0)