summaryrefslogtreecommitdiff
path: root/astroid/tree/scoped_nodes.py
diff options
context:
space:
mode:
authorClaudiu Popa <pcmanticore@gmail.com>2016-01-04 14:46:43 +0200
committerClaudiu Popa <pcmanticore@gmail.com>2016-01-04 14:46:43 +0200
commitd39369f422ca344782aa2356a91e25f9db4e8192 (patch)
treeebbd2650ea8d6e47c7d04a748369fc7ea48d3c2b /astroid/tree/scoped_nodes.py
parent0a55e866e32548ea2de39db529802c22f2041b7f (diff)
downloadastroid-git-d39369f422ca344782aa2356a91e25f9db4e8192.tar.gz
Use keys and values as separate arguments for nodes.Dict
Dict was a bit different that the corresponding class from the builtin ast module with respect to how it was initialized. Instead of accepting a list of pairs, the initializer accepts two arguments, one for keys, the other for values. For backward compatibility, the class gained a new .items property.
Diffstat (limited to 'astroid/tree/scoped_nodes.py')
-rw-r--r--astroid/tree/scoped_nodes.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/astroid/tree/scoped_nodes.py b/astroid/tree/scoped_nodes.py
index 6e53dc33..d04b549b 100644
--- a/astroid/tree/scoped_nodes.py
+++ b/astroid/tree/scoped_nodes.py
@@ -763,9 +763,12 @@ class CallSite(object):
kwarg = node_classes.Dict(lineno=self._funcnode.args.lineno,
col_offset=self._funcnode.args.col_offset,
parent=self._funcnode.args)
- kwarg.postinit([(node_classes.Const(key, parent=kwarg), value)
- for key, value in kwargs.items()])
+ items = [(node_classes.Const(key, parent=kwarg), value)
+ for key, value in kwargs.items()]
+ keys, values = zip(*items)
+ kwarg.postinit(keys, values)
return iter((kwarg, ))
+
elif self._funcnode.args.vararg == name:
# It wants all the args that were passed into
# the call site.