forked from VimPlug/jedi
Small fix for dict lookups.
This commit is contained in:
@@ -214,14 +214,15 @@ class Array(IterableWrapper):
|
|||||||
def get_exact_index_types(self, mixed_index):
|
def get_exact_index_types(self, mixed_index):
|
||||||
""" Here the index is an int/str. Raises IndexError/KeyError """
|
""" Here the index is an int/str. Raises IndexError/KeyError """
|
||||||
if self.type == pr.Array.DICT:
|
if self.type == pr.Array.DICT:
|
||||||
for key, value in self._items():
|
for key, values in self._items():
|
||||||
# Because we only want the key to be a string.
|
# Because we only want the key to be a string.
|
||||||
keys = self._evaluator.eval_element(key)
|
keys = self._evaluator.eval_element(key)
|
||||||
|
|
||||||
for k in keys:
|
for k in keys:
|
||||||
if isinstance(k, compiled.CompiledObject) \
|
if isinstance(k, compiled.CompiledObject) \
|
||||||
and mixed_index == k.obj:
|
and mixed_index == k.obj:
|
||||||
return self._evaluator.eval_element(value)
|
for value in values:
|
||||||
|
return self._evaluator.eval_element(value)
|
||||||
raise KeyError('No key found in dictionary %s.' % self)
|
raise KeyError('No key found in dictionary %s.' % self)
|
||||||
|
|
||||||
# Can raise an IndexError
|
# Can raise an IndexError
|
||||||
|
|||||||
Reference in New Issue
Block a user