diff options
| author | Marc Mueller <30130371+cdce8p@users.noreply.github.com> | 2021-06-19 13:27:14 +0200 |
|---|---|---|
| committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2021-06-19 15:56:24 +0200 |
| commit | 52538af9e134ef6ea67611ff892a1250373beefe (patch) | |
| tree | 046d234720beaa3e402c30be9bed3ed3bef19c4e | |
| parent | 075c9732b2c457b9fdd2fe002de21915fa8fffa4 (diff) | |
| download | astroid-git-52538af9e134ef6ea67611ff892a1250373beefe.tar.gz | |
Add context type hints
| -rw-r--r-- | astroid/node_classes.py | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/astroid/node_classes.py b/astroid/node_classes.py index b0bfe715..46d15642 100644 --- a/astroid/node_classes.py +++ b/astroid/node_classes.py @@ -45,6 +45,7 @@ from typing import ClassVar, Optional from astroid import as_string, bases from astroid import context as contextmod from astroid import decorators, manager, mixins, util +from astroid.const import Context from astroid.exceptions import ( AstroidError, AstroidIndexError, @@ -3690,14 +3691,13 @@ class List(_BaseContainer): def __init__( self, - ctx=None, + ctx: Optional[Context] = None, lineno: Optional[int] = None, col_offset: Optional[int] = None, parent: Optional[NodeNG] = None, ) -> None: """ :param ctx: Whether the list is assigned to or loaded from. - :type ctx: Context or None :param lineno: The line that this node appears on in the source code. @@ -3706,11 +3706,8 @@ class List(_BaseContainer): :param parent: The parent node in the syntax tree. """ - self.ctx = ctx - """Whether the list is assigned to or loaded from. - - :type: Context or None - """ + self.ctx: Optional[Context] = ctx + """Whether the list is assigned to or loaded from.""" super().__init__(lineno=lineno, col_offset=col_offset, parent=parent) @@ -4034,14 +4031,13 @@ class Starred(mixins.ParentAssignTypeMixin, NodeNG): def __init__( self, - ctx=None, + ctx: Optional[Context] = None, lineno: Optional[int] = None, col_offset: Optional[int] = None, parent: Optional[NodeNG] = None, ) -> None: """ :param ctx: Whether the list is assigned to or loaded from. - :type ctx: Context or None :param lineno: The line that this node appears on in the source code. @@ -4053,11 +4049,8 @@ class Starred(mixins.ParentAssignTypeMixin, NodeNG): self.value: Optional[NodeNG] = None """What is being unpacked.""" - self.ctx = ctx - """Whether the starred item is assigned to or loaded from. - - :type: Context or None - """ + self.ctx: Optional[Context] = ctx + """Whether the starred item is assigned to or loaded from.""" super().__init__(lineno=lineno, col_offset=col_offset, parent=parent) @@ -4085,14 +4078,13 @@ class Subscript(NodeNG): def __init__( self, - ctx=None, + ctx: Optional[Context] = None, lineno: Optional[int] = None, col_offset: Optional[int] = None, parent: Optional[NodeNG] = None, ) -> None: """ :param ctx: Whether the subscripted item is assigned to or loaded from. - :type ctx: Context or None :param lineno: The line that this node appears on in the source code. @@ -4107,11 +4099,8 @@ class Subscript(NodeNG): self.slice: Optional[NodeNG] = None """The slice being used to lookup.""" - self.ctx = ctx - """Whether the subscripted item is assigned to or loaded from. - - :type: Context or None - """ + self.ctx: Optional[Context] = ctx + """Whether the subscripted item is assigned to or loaded from.""" super().__init__(lineno=lineno, col_offset=col_offset, parent=parent) |
