summaryrefslogtreecommitdiff
path: root/astroid/node_classes.py
diff options
context:
space:
mode:
authorAshley Whetter <AWhetter@users.noreply.github.com>2019-05-14 02:56:00 -0700
committerClaudiu Popa <pcmanticore@gmail.com>2019-05-14 11:56:00 +0200
commit7bb86ab8444b80da30507bcf6cb58d197537e17d (patch)
treea56cca6f7e62f1258d0cf1fd3324badba98ab347 /astroid/node_classes.py
parente0a298df55b15abcb77c2a93253f5ab7be52d0fb (diff)
downloadastroid-git-7bb86ab8444b80da30507bcf6cb58d197537e17d.tar.gz
Can access per argument type comments (#667)
Close #665
Diffstat (limited to 'astroid/node_classes.py')
-rw-r--r--astroid/node_classes.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/astroid/node_classes.py b/astroid/node_classes.py
index 449470d0..2e39b060 100644
--- a/astroid/node_classes.py
+++ b/astroid/node_classes.py
@@ -1425,6 +1425,7 @@ class Arguments(mixins.AssignTypeMixin, NodeNG):
"varargannotation",
"kwargannotation",
"kwonlyargs_annotations",
+ "type_comment_args",
)
varargannotation = None
"""The type annotation for the variable length arguments.
@@ -1499,6 +1500,15 @@ class Arguments(mixins.AssignTypeMixin, NodeNG):
:type: list(NodeNG)
"""
+ self.type_comment_args = []
+ """The type annotation, passed by a type comment, of each argument.
+
+ If an argument does not have a type comment,
+ the value for that argument will be None.
+
+ :type: list(NodeNG or None)
+ """
+
def postinit(
self,
args,
@@ -1509,6 +1519,7 @@ class Arguments(mixins.AssignTypeMixin, NodeNG):
kwonlyargs_annotations=None,
varargannotation=None,
kwargannotation=None,
+ type_comment_args=None,
):
"""Do some setup after initialisation.
@@ -1543,6 +1554,10 @@ class Arguments(mixins.AssignTypeMixin, NodeNG):
:param kwargannotation: The type annotation for the variable length
keyword arguments.
:type kwargannotation: NodeNG
+
+ :param type_comment_args: The type annotation,
+ passed by a type comment, of each argument.
+ :type type_comment_args: list(NodeNG or None)
"""
self.args = args
self.defaults = defaults
@@ -1552,6 +1567,7 @@ class Arguments(mixins.AssignTypeMixin, NodeNG):
self.kwonlyargs_annotations = kwonlyargs_annotations
self.varargannotation = varargannotation
self.kwargannotation = kwargannotation
+ self.type_comment_args = type_comment_args
def _infer_name(self, frame, name):
if self.parent is frame: