diff options
| author | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2023-04-03 20:45:12 +0200 |
|---|---|---|
| committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-04-03 21:13:53 +0200 |
| commit | ae660142aac5d7fa0d137088f3fda5f48b97a37a (patch) | |
| tree | a894752c62e64a2bd5c3c8227d3a8f384e7542a2 /astroid/nodes/node_classes.py | |
| parent | 225c146e59668a461e6ff0ef0c43233fe500b86a (diff) | |
| download | astroid-git-ae660142aac5d7fa0d137088f3fda5f48b97a37a.tar.gz | |
Fix constructors of ``UnaryOp``
Diffstat (limited to 'astroid/nodes/node_classes.py')
| -rw-r--r-- | astroid/nodes/node_classes.py | 42 |
1 files changed, 11 insertions, 31 deletions
diff --git a/astroid/nodes/node_classes.py b/astroid/nodes/node_classes.py index 9f0de347..09a9d05a 100644 --- a/astroid/nodes/node_classes.py +++ b/astroid/nodes/node_classes.py @@ -4045,38 +4045,22 @@ class UnaryOp(NodeNG): _astroid_fields = ("operand",) _other_fields = ("op",) - @decorators.deprecate_default_argument_values(op="str") + operand: NodeNG + """What the unary operator is applied to.""" + 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.op: str | None = op + self.op = op """The operator.""" - self.operand: NodeNG | None = None - """What the unary operator is applied to.""" - super().__init__( lineno=lineno, col_offset=col_offset, @@ -4085,11 +4069,7 @@ class UnaryOp(NodeNG): parent=parent, ) - def postinit(self, operand: NodeNG | None = None) -> None: - """Do some setup after initialisation. - - :param operand: What the unary operator is applied to. - """ + def postinit(self, operand: NodeNG) -> None: self.operand = operand # This is set by inference.py |
