1
0
forked from VimPlug/jedi

Start creating py__getitem__.

This commit is contained in:
Dave Halter
2015-12-04 12:08:29 +01:00
parent 76345c0b58
commit db060c70c9
7 changed files with 76 additions and 45 deletions

View File

@@ -319,14 +319,14 @@ class Name(Leaf):
def assignment_indexes(self):
"""
Returns an array of ints of the indexes that are used in tuple
assignments.
Returns an array of tuple(int, node) of the indexes that are used in
tuple assignments.
For example if the name is ``y`` in the following code::
x, (y, z) = 2, ''
would result in ``[1, 0]``.
would result in ``[(1, xyz_node), (0, yz_node)]``.
"""
indexes = []
node = self.parent
@@ -335,7 +335,7 @@ class Name(Leaf):
if is_node(node, 'testlist_comp', 'testlist_star_expr', 'exprlist'):
for i, child in enumerate(node.children):
if child == compare:
indexes.insert(0, int(i / 2))
indexes.insert(0, (int(i / 2), node))
break
else:
raise LookupError("Couldn't find the assignment.")