diff options
| author | Nick Drozd <nicholasdrozd@gmail.com> | 2023-04-04 18:22:16 -0400 |
|---|---|---|
| committer | Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com> | 2023-04-05 09:15:01 +0200 |
| commit | 92a51d0830a866450fbf75e45b840c8247bdb829 (patch) | |
| tree | b39a2c5313a5ac04c551535e1b6af8b6e0bfeef0 | |
| parent | 569b63706ea5ab7efab7ffe2ef91e6772c5e38ec (diff) | |
| download | astroid-git-92a51d0830a866450fbf75e45b840c8247bdb829.tar.gz | |
Mandatory fields for Slice
| -rw-r--r-- | ChangeLog | 1 | ||||
| -rw-r--r-- | astroid/nodes/node_classes.py | 56 |
2 files changed, 10 insertions, 47 deletions
@@ -30,6 +30,7 @@ Release date: TBA - ``nodes.IfExp`` - ``nodes.Keyword`` - ``nodes.Name`` + - ``nodes.Slice`` - ``nodes.Starred`` - ``nodes.Subscript`` - ``nodes.UnaryOp`` diff --git a/astroid/nodes/node_classes.py b/astroid/nodes/node_classes.py index 2b24d8ef..bb581af9 100644 --- a/astroid/nodes/node_classes.py +++ b/astroid/nodes/node_classes.py @@ -3160,59 +3160,21 @@ class Slice(NodeNG): _astroid_fields = ("lower", "upper", "step") - 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. + lower: NodeNG | None + """The lower index in the slice.""" - :param col_offset: The column that this node appears on in the - source code. + upper: NodeNG | None + """The upper index in the slice.""" - :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.lower: NodeNG | None = None # can be None - """The lower index in the slice.""" - - self.upper: NodeNG | None = None # can be None - """The upper index in the slice.""" - - self.step: NodeNG | None = None # can be None - """The step to take between indexes.""" - - super().__init__( - lineno=lineno, - col_offset=col_offset, - end_lineno=end_lineno, - end_col_offset=end_col_offset, - parent=parent, - ) + step: NodeNG | None + """The step to take between indexes.""" def postinit( self, - lower: NodeNG | None = None, - upper: NodeNG | None = None, - step: NodeNG | None = None, + lower: NodeNG | None, + upper: NodeNG | None, + step: NodeNG | None, ) -> None: - """Do some setup after initialisation. - - :param lower: The lower index in the slice. - - :param upper: The upper index in the slice. - - :param step: The step to take between index. - """ self.lower = lower self.upper = upper self.step = step |
