summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>2023-04-03 20:39:15 +0200
committerPierre Sassoulas <pierre.sassoulas@gmail.com>2023-04-03 21:13:53 +0200
commit225c146e59668a461e6ff0ef0c43233fe500b86a (patch)
treebb8b84db6de9f14385c17673ea792453dd713d0f
parent27d8187c47de23f5da0c9d19bc265c3fb50e9743 (diff)
downloadastroid-git-225c146e59668a461e6ff0ef0c43233fe500b86a.tar.gz
Fix constructors of ``Compare``
-rw-r--r--ChangeLog1
-rw-r--r--astroid/nodes/node_classes.py55
2 files changed, 7 insertions, 49 deletions
diff --git a/ChangeLog b/ChangeLog
index e704b7cf..e43aec65 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,7 @@ Release date: TBA
- ``nodes.Attribute``
- ``nodes.AugAssign``
- ``nodes.BinOp``
+ - ``nodes.Compare``
- ``nodes.Delete``
- ``nodes.DelAttr``
- ``nodes.DelName``
diff --git a/astroid/nodes/node_classes.py b/astroid/nodes/node_classes.py
index 7415fbe5..9f0de347 100644
--- a/astroid/nodes/node_classes.py
+++ b/astroid/nodes/node_classes.py
@@ -1632,58 +1632,15 @@ class Compare(NodeNG):
_astroid_fields = ("left", "ops")
- 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.left: NodeNG | None = None
- """The value at the left being applied to a comparison operator."""
-
- self.ops: list[tuple[str, NodeNG]] = []
- """The remainder of the operators and their relevant right hand value."""
-
- super().__init__(
- lineno=lineno,
- col_offset=col_offset,
- end_lineno=end_lineno,
- end_col_offset=end_col_offset,
- parent=parent,
- )
-
- def postinit(
- self,
- left: NodeNG | None = None,
- ops: list[tuple[str, NodeNG]] | None = None,
- ) -> None:
- """Do some setup after initialisation.
+ left: NodeNG
+ """The value at the left being applied to a comparison operator."""
- :param left: The value at the left being applied to a comparison
- operator.
+ ops: list[tuple[str, NodeNG]]
+ """The remainder of the operators and their relevant right hand value."""
- :param ops: The remainder of the operators
- and their relevant right hand value.
- """
+ def postinit(self, left: NodeNG, ops: list[tuple[str, NodeNG]]) -> None:
self.left = left
- if ops is not None:
- self.ops = ops
+ self.ops = ops
def get_children(self):
"""Get the child nodes below this node.