diff options
| author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2023-04-03 20:33:06 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-03 20:33:06 +0200 |
| commit | ecd28b69ba6b7cc4c914ff6d6bf188a3ad3c9c68 (patch) | |
| tree | 35e4fe52c0f7d763a002b97bf63e89ff0f922232 /astroid/nodes/node_classes.py | |
| parent | c3f65bd8f7b7e5b66013ebf3275dd6e062ab1ec8 (diff) | |
| download | astroid-git-ecd28b69ba6b7cc4c914ff6d6bf188a3ad3c9c68.tar.gz | |
Fix constructors of ``AugAssign`` (#2082)
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
Diffstat (limited to 'astroid/nodes/node_classes.py')
| -rw-r--r-- | astroid/nodes/node_classes.py | 53 |
1 files changed, 14 insertions, 39 deletions
diff --git a/astroid/nodes/node_classes.py b/astroid/nodes/node_classes.py index f1f59218..d7f14ca1 100644 --- a/astroid/nodes/node_classes.py +++ b/astroid/nodes/node_classes.py @@ -1296,45 +1296,28 @@ class AugAssign(_base_nodes.AssignTypeNode, _base_nodes.Statement): _astroid_fields = ("target", "value") _other_fields = ("op",) - @decorators.deprecate_default_argument_values(op="str") + target: Name | Attribute | Subscript + """What is being assigned to.""" + + value: NodeNG + """The value being assigned to the variable.""" + def __init__( self, - op: str | None = None, - lineno: int | None = None, - col_offset: int | None = None, - parent: NodeNG | None = None, + op: str, + lineno: int, + col_offset: int, + parent: NodeNG, *, - end_lineno: int | None = None, - end_col_offset: int | None = None, + end_lineno: int | None, + end_col_offset: int | None, ) -> None: - """ - :param op: The operator that is being combined with the assignment. - This includes the equals sign. - - :param lineno: The line that this node appears on in the source code. - - :param col_offset: The column that this node appears on in the - source code. - - :param parent: The parent node in the syntax tree. - - :param end_lineno: The last line this node appears on in the source code. - - :param end_col_offset: The end column this node appears on in the - source code. Note: This is after the last symbol. - """ - self.target: NodeNG | None = None - """What is being assigned to.""" - - self.op: str | None = op + self.op = op """The operator that is being combined with the assignment. This includes the equals sign. """ - self.value: NodeNG | None = None - """The value being assigned to the variable.""" - super().__init__( lineno=lineno, col_offset=col_offset, @@ -1343,15 +1326,7 @@ class AugAssign(_base_nodes.AssignTypeNode, _base_nodes.Statement): parent=parent, ) - def postinit( - self, target: NodeNG | None = None, value: NodeNG | None = None - ) -> None: - """Do some setup after initialisation. - - :param target: What is being assigned to. - - :param value: The value being assigned to the variable. - """ + def postinit(self, target: Name | Attribute | Subscript, value: NodeNG) -> None: self.target = target self.value = value |
