forked from VimPlug/jedi
Fix an issue with dict lookups.
This commit is contained in:
@@ -272,12 +272,7 @@ class Array(IterableWrapper, ArrayMixin):
|
|||||||
"""Here the index is an int/str. Raises IndexError/KeyError."""
|
"""Here the index is an int/str. Raises IndexError/KeyError."""
|
||||||
if self.type == 'dict':
|
if self.type == 'dict':
|
||||||
for key, values in self._items():
|
for key, values in self._items():
|
||||||
# Because we only want the key to be a string.
|
if index == key:
|
||||||
keys = self._evaluator.eval_element(key)
|
|
||||||
|
|
||||||
for k in keys:
|
|
||||||
if isinstance(k, compiled.CompiledObject) \
|
|
||||||
and index == k.obj:
|
|
||||||
for value in values:
|
for value in values:
|
||||||
return self._evaluator.eval_element(value)
|
return self._evaluator.eval_element(value)
|
||||||
raise KeyError('No key found in dictionary %s.' % self)
|
raise KeyError('No key found in dictionary %s.' % self)
|
||||||
@@ -434,6 +429,9 @@ class MergedArray(_FakeArray):
|
|||||||
def values(self):
|
def values(self):
|
||||||
return unite((a.values() for a in self._arrays))
|
return unite((a.values() for a in self._arrays))
|
||||||
|
|
||||||
|
def py__getitem__(self, index):
|
||||||
|
return unite(self.py__iter__())
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
for array in self._arrays:
|
for array in self._arrays:
|
||||||
for a in array:
|
for a in array:
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ def gen():
|
|||||||
a, b = next(gen())
|
a, b = next(gen())
|
||||||
#? int()
|
#? int()
|
||||||
a
|
a
|
||||||
#? str() float()
|
#? str()
|
||||||
b
|
b
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user