diff options
| author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2023-04-03 19:58:58 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-03 19:58:58 +0200 |
| commit | a20c9c78f5683db585a937a5a7defa78822c1908 (patch) | |
| tree | d925fec1426d9f29096b8717471beae03933a902 /astroid/nodes/node_classes.py | |
| parent | 00b33a5f15d238a3fe751b30e79aa212b55a14a5 (diff) | |
| download | astroid-git-a20c9c78f5683db585a937a5a7defa78822c1908.tar.gz | |
Fix constructors of ``BinOp`` (#2081)
Diffstat (limited to 'astroid/nodes/node_classes.py')
| -rw-r--r-- | astroid/nodes/node_classes.py | 50 |
1 files changed, 14 insertions, 36 deletions
diff --git a/astroid/nodes/node_classes.py b/astroid/nodes/node_classes.py index 1bb195ae..512dd00b 100644 --- a/astroid/nodes/node_classes.py +++ b/astroid/nodes/node_classes.py @@ -1497,41 +1497,25 @@ class BinOp(NodeNG): _astroid_fields = ("left", "right") _other_fields = ("op",) - @decorators.deprecate_default_argument_values(op="str") + left: NodeNG + """What is being applied to the operator on the left side.""" + + right: NodeNG + """What is being applied to the operator on the right side.""" + 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. - - :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 - """What is being applied to the operator on the left side.""" - - self.op: str | None = op + self.op = op """The operator.""" - self.right: NodeNG | None = None - """What is being applied to the operator on the right side.""" - super().__init__( lineno=lineno, col_offset=col_offset, @@ -1540,13 +1524,7 @@ class BinOp(NodeNG): parent=parent, ) - def postinit(self, left: NodeNG | None = None, right: NodeNG | None = None) -> None: - """Do some setup after initialisation. - - :param left: What is being applied to the operator on the left side. - - :param right: What is being applied to the operator on the right side. - """ + def postinit(self, left: NodeNG, right: NodeNG) -> None: self.left = left self.right = right |
