diff options
| author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2023-04-03 20:39:15 +0200 |
|---|---|---|
| committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-04-03 21:13:53 +0200 |
| commit | 225c146e59668a461e6ff0ef0c43233fe500b86a (patch) | |
| tree | bb8b84db6de9f14385c17673ea792453dd713d0f /astroid/nodes/node_classes.py | |
| parent | 27d8187c47de23f5da0c9d19bc265c3fb50e9743 (diff) | |
| download | astroid-git-225c146e59668a461e6ff0ef0c43233fe500b86a.tar.gz | |
Fix constructors of ``Compare``
Diffstat (limited to 'astroid/nodes/node_classes.py')
| -rw-r--r-- | astroid/nodes/node_classes.py | 55 |
1 files changed, 6 insertions, 49 deletions
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. |
