Skip to content

Commit 2ffcedb

Browse files
committed
Fix __replace__ in ast.pyi
1 parent bbf45d8 commit 2ffcedb

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

stdlib/ast.pyi

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -164,16 +164,17 @@ class FunctionDef(stmt):
164164
) -> None: ...
165165

166166
if sys.version_info >= (3, 14):
167-
def __replace__(
167+
def __replace__( # type: ignore[override]
168168
self,
169169
*,
170170
name: str = ...,
171171
args: arguments = ...,
172172
body: list[stmt] = ...,
173173
decorator_list: list[expr] = ...,
174-
returns: expr | None = ...,
175-
type_comment: str | None = ...,
174+
returns: expr | None,
175+
type_comment: str | None,
176176
type_params: list[type_param] = ...,
177+
**kwargs: Unpack[_Attributes],
177178
) -> Self: ...
178179

179180
class AsyncFunctionDef(stmt):
@@ -240,16 +241,16 @@ class AsyncFunctionDef(stmt):
240241
) -> None: ...
241242

242243
if sys.version_info >= (3, 14):
243-
def __replace__(
244+
def __replace__( # type: ignore[override]
244245
self,
245246
*,
246247
name: str = ...,
247248
args: arguments = ...,
248-
body: list[stmt],
249-
decorator_list: list[expr],
249+
body: list[stmt] = ...,
250+
decorator_list: list[expr] = ...,
250251
returns: expr | None,
251252
type_comment: str | None,
252-
type_params: list[type_param],
253+
type_params: list[type_param] = ...,
253254
) -> Self: ...
254255

255256
class ClassDef(stmt):
@@ -301,12 +302,12 @@ class ClassDef(stmt):
301302
def __replace__(
302303
self,
303304
*,
304-
name: str,
305-
bases: list[expr],
306-
keywords: list[keyword],
307-
body: list[stmt],
308-
decorator_list: list[expr],
309-
type_params: list[type_param],
305+
name: str = ...,
306+
bases: list[expr] = ...,
307+
keywords: list[keyword] = ...,
308+
body: list[stmt] = ...,
309+
decorator_list: list[expr] = ...,
310+
type_params: list[type_param] = ...,
310311
**kwargs: Unpack[_Attributes],
311312
) -> Self: ...
312313

@@ -377,7 +378,7 @@ if sys.version_info >= (3, 12):
377378
) -> None: ...
378379

379380
if sys.version_info >= (3, 14):
380-
def __replace__(
381+
def __replace__( # type: ignore[override]
381382
self,
382383
*,
383384
name: Name = ...,
@@ -540,7 +541,7 @@ class While(stmt):
540541
def __init__(self, test: expr, body: list[stmt], orelse: list[stmt], **kwargs: Unpack[_Attributes]) -> None: ...
541542

542543
if sys.version_info >= (3, 14):
543-
def __replace__(self, *, test: expr, body: list[stmt], orelse: list[stmt], **kwargs: Unpack[_Attributes]) -> Self: ...
544+
def __replace__(self, *, test: expr = ..., body: list[stmt] = ..., orelse: list[stmt] = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
544545

545546
class If(stmt):
546547
if sys.version_info >= (3, 10):
@@ -725,7 +726,7 @@ class Assert(stmt):
725726
def __init__(self, test: expr, msg: expr | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
726727

727728
if sys.version_info >= (3, 14):
728-
def __replace__(self, *, test: expr, msg: expr | None, **kwargs: Unpack[_Attributes]) -> Self: ...
729+
def __replace__(self, *, test: expr = ..., msg: expr | None, **kwargs: Unpack[_Attributes]) -> Self: ... # type: ignore[override]
729730

730731
class Import(stmt):
731732
if sys.version_info >= (3, 10):
@@ -775,7 +776,7 @@ class Global(stmt):
775776
def __init__(self, names: list[str], **kwargs: Unpack[_Attributes]) -> None: ...
776777

777778
if sys.version_info >= (3, 14):
778-
def __replace__(self, *, names: list[str], **kwargs: Unpack[_Attributes]) -> Self: ...
779+
def __replace__(self, *, names: list[str] = ..., **kwargs: Unpack[_Attributes]) -> Self: ...
779780

780781
class Nonlocal(stmt):
781782
if sys.version_info >= (3, 10):

0 commit comments

Comments
 (0)