Skip to content

Commit bb880f2

Browse files
authored
improvement: don't require args of type expr_context to be passed to constructor
1 parent 9655775 commit bb880f2

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

stdlib/_ast.pyi

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,8 @@ class Attribute(expr):
582582
__match_args__ = ("value", "attr", "ctx")
583583
value: expr
584584
attr: _Identifier
585-
ctx: expr_context
586-
def __init__(self, value: expr, attr: _Identifier, ctx: expr_context, **kwargs: Unpack[_Attributes]) -> None: ...
585+
ctx: expr_context # Not present in Python < 3.13 if not passed to `__init__`
586+
def __init__(self, value: expr, attr: _Identifier, ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
587587

588588
if sys.version_info >= (3, 9):
589589
_Slice: typing_extensions.TypeAlias = expr
@@ -615,39 +615,39 @@ class Subscript(expr):
615615
__match_args__ = ("value", "slice", "ctx")
616616
value: expr
617617
slice: _Slice
618-
ctx: expr_context
619-
def __init__(self, value: expr, slice: _Slice, ctx: expr_context, **kwargs: Unpack[_Attributes]) -> None: ...
618+
ctx: expr_context # Not present in Python < 3.13 if not passed to `__init__`
619+
def __init__(self, value: expr, slice: _Slice, ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
620620

621621
class Starred(expr):
622622
if sys.version_info >= (3, 10):
623623
__match_args__ = ("value", "ctx")
624624
value: expr
625-
ctx: expr_context
626-
def __init__(self, value: expr, ctx: expr_context, **kwargs: Unpack[_Attributes]) -> None: ...
625+
ctx: expr_context # Not present in Python < 3.13 if not passed to `__init__`
626+
def __init__(self, value: expr, ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
627627

628628
class Name(expr):
629629
if sys.version_info >= (3, 10):
630630
__match_args__ = ("id", "ctx")
631631
id: _Identifier
632-
ctx: expr_context
633-
def __init__(self, id: _Identifier, ctx: expr_context, **kwargs: Unpack[_Attributes]) -> None: ...
632+
ctx: expr_context # Not present in Python < 3.13 if not passed to `__init__`
633+
def __init__(self, id: _Identifier, ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
634634

635635
class List(expr):
636636
if sys.version_info >= (3, 10):
637637
__match_args__ = ("elts", "ctx")
638638
elts: list[expr]
639-
ctx: expr_context
640-
def __init__(self, elts: list[expr], ctx: expr_context, **kwargs: Unpack[_Attributes]) -> None: ...
639+
ctx: expr_context # Not present in Python < 3.13 if not passed to `__init__`
640+
def __init__(self, elts: list[expr], ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
641641

642642
class Tuple(expr):
643643
if sys.version_info >= (3, 10):
644644
__match_args__ = ("elts", "ctx")
645645
elts: list[expr]
646-
ctx: expr_context
646+
ctx: expr_context # Not present in Python < 3.13 if not passed to `__init__`
647647
if sys.version_info >= (3, 9):
648648
dims: list[expr]
649649

650-
def __init__(self, elts: list[expr], ctx: expr_context, **kwargs: Unpack[_Attributes]) -> None: ...
650+
def __init__(self, elts: list[expr], ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
651651

652652
class expr_context(AST): ...
653653

0 commit comments

Comments
 (0)