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:30:54 +0200
committerGitHub <noreply@github.com>2023-04-03 20:30:54 +0200
commit183b2de1b131416239002b8afd3222737554a87b (patch)
tree840a142bff17b9ba8931009c7459723d86ecb35d /astroid/nodes/node_classes.py
parentc4d14363d1c271a41fa3203eb9ab0ede33e9ab41 (diff)
downloadastroid-git-183b2de1b131416239002b8afd3222737554a87b.tar.gz
Fix constructors of ``Subscript`` (#2083)
Diffstat (limited to 'astroid/nodes/node_classes.py')
-rw-r--r--astroid/nodes/node_classes.py51
1 files changed, 14 insertions, 37 deletions
diff --git a/astroid/nodes/node_classes.py b/astroid/nodes/node_classes.py
index f6250542..42ed18d4 100644
--- a/astroid/nodes/node_classes.py
+++ b/astroid/nodes/node_classes.py
@@ -3776,38 +3776,23 @@ class Subscript(NodeNG):
infer_lhs: ClassVar[InferLHS[Subscript]]
+ value: NodeNG
+ """What is being indexed."""
+
+ slice: NodeNG
+ """The slice being used to lookup."""
+
def __init__(
self,
- ctx: Context | None = None,
- lineno: int | None = None,
- col_offset: int | None = None,
- parent: NodeNG | None = None,
+ ctx: Context,
+ 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 ctx: Whether the subscripted item is assigned to or loaded from.
-
- :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.value: NodeNG | None = None
- """What is being indexed."""
-
- self.slice: NodeNG | None = None
- """The slice being used to lookup."""
-
- self.ctx: Context | None = ctx
+ self.ctx = ctx
"""Whether the subscripted item is assigned to or loaded from."""
super().__init__(
@@ -3819,15 +3804,7 @@ class Subscript(NodeNG):
)
# pylint: disable=redefined-builtin; had to use the same name as builtin ast module.
- def postinit(
- self, value: NodeNG | None = None, slice: NodeNG | None = None
- ) -> None:
- """Do some setup after initialisation.
-
- :param value: What is being indexed.
-
- :param slice: The slice being used to lookup.
- """
+ def postinit(self, value: NodeNG, slice: NodeNG) -> None:
self.value = value
self.slice = slice