summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2015-09-12 14:27:21 +0300
committerClaudiu Popa <pcmanticore@gmail.com>2015-09-12 14:27:21 +0300
commitf1da32b6ab1f65d748116a188b8964ac37c0ccec (patch)
treeb36c651e60c88147cff5728cb97a54bee4abbcae
parent9a32f50ca14360d63e5b5f146b288834a10b5e09 (diff)
downloadastroid-git-f1da32b6ab1f65d748116a188b8964ac37c0ccec.tar.gz
Add Call.starargs and Call.kwargs properties
They were added in order to have a minimum level of backward compatibility, since they were removed from the class. This is also an easy way to retrieve them, instead of looking explicitly for them in args or keywords respectively.
-rw-r--r--astroid/node_classes.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/astroid/node_classes.py b/astroid/node_classes.py
index 524cb4e6..aef8dd02 100644
--- a/astroid/node_classes.py
+++ b/astroid/node_classes.py
@@ -618,6 +618,16 @@ class Call(bases.NodeNG):
self.args = args
self.keywords = keywords
+ @property
+ def starargs(self):
+ args = self.args or []
+ return [arg for arg in args if isinstance(arg, Starred)]
+
+ @property
+ def kwargs(self):
+ keywords = self.keywords or []
+ return [keyword for keyword in keywords if keyword.arg is None]
+
class Compare(bases.NodeNG):
"""class representing a Compare node"""