summaryrefslogtreecommitdiff
path: root/astroid/nodes/node_classes.py
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2023-04-03 20:47:41 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2023-04-03 21:13:53 +0200
commit3c5b1d2a714db321346511860f4667cb2d6f6cdd (patch)
tree1d207f93662a4dfc2f3cceb660c96d81afe54a70 /astroid/nodes/node_classes.py
parentae660142aac5d7fa0d137088f3fda5f48b97a37a (diff)
downloadastroid-git-3c5b1d2a714db321346511860f4667cb2d6f6cdd.tar.gz
Fix constructors of ``AnnAssign``
Diffstat (limited to 'astroid/nodes/node_classes.py')
-rw-r--r--astroid/nodes/node_classes.py61
1 files changed, 10 insertions, 51 deletions
diff --git a/astroid/nodes/node_classes.py b/astroid/nodes/node_classes.py
index 09a9d05a..eea74e7f 100644
--- a/astroid/nodes/node_classes.py
+++ b/astroid/nodes/node_classes.py
@@ -1204,66 +1204,25 @@ class AnnAssign(_base_nodes.AssignTypeNode, _base_nodes.Statement):
_astroid_fields = ("target", "annotation", "value")
_other_fields = ("simple",)
- def __init__(
- self,
- lineno: int | None = None,
- col_offset: int | None = None,
- parent: NodeNG | None = None,
- *,
- end_lineno: int | None = None,
- end_col_offset: int | None = None,
- ) -> None:
- """
- :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.annotation: NodeNG | None = None
- """The type annotation of what is being assigned to."""
+ target: Name | Attribute | Subscript
+ """What is being assigned to."""
- self.value: NodeNG | None = None # can be None
- """The value being assigned to the variables."""
+ annotation: NodeNG
+ """The type annotation of what is being assigned to."""
- self.simple: int | None = None
- """Whether :attr:`target` is a pure name or a complex statement."""
+ value: NodeNG | None
+ """The value being assigned to the variables."""
- super().__init__(
- lineno=lineno,
- col_offset=col_offset,
- end_lineno=end_lineno,
- end_col_offset=end_col_offset,
- parent=parent,
- )
+ simple: int
+ """Whether :attr:`target` is a pure name or a complex statement."""
def postinit(
self,
- target: NodeNG,
+ target: Name | Attribute | Subscript,
annotation: NodeNG,
simple: int,
- value: NodeNG | None = None,
+ value: NodeNG | None,
) -> None:
- """Do some setup after initialisation.
-
- :param target: What is being assigned to.
-
- :param annotation: The type annotation of what is being assigned to.
-
- :param simple: Whether :attr:`target` is a pure name
- or a complex statement.
-
- :param value: The value being assigned to the variables.
- """
self.target = target
self.annotation = annotation
self.value = value