1
0
forked from VimPlug/jedi

fixed dict problems

This commit is contained in:
David Halter
2013-02-20 22:37:32 +04:30
parent 06a54f30a8
commit f2cdf03e6e
2 changed files with 12 additions and 11 deletions

View File

@@ -121,7 +121,7 @@ class Script(object):
for c in names: for c in names:
completions.append((c, s)) completions.append((c, s))
if not dot: # named_params have no dots if not dot: # named params have no dots
call_def = self.get_in_function_call() call_def = self.get_in_function_call()
if call_def: if call_def:
if not call_def.module.is_builtin(): if not call_def.module.is_builtin():

View File

@@ -838,16 +838,17 @@ class Array(use_metaclass(cache.CachedMetaClass, pr.Base)):
for i, key_statement in enumerate(self._array.keys): for i, key_statement in enumerate(self._array.keys):
# Because we only want the key to be a string. # Because we only want the key to be a string.
key_commands = key_statement.get_commands() key_commands = key_statement.get_commands()
if len(key_commands) == 1: if len(key_commands) != 1: # cannot deal with complex strings
key = key_commands[0] continue
key.get_code() key = key_commands[0]
try: if isinstance(key, pr.Call) and key.type == pr.Call.STRING:
str_key = key.get_code() str_key = key.name
except AttributeError: elif isinstance(key, pr.Name):
str_key = None str_key = str(key)
if mixed_index == str_key:
index = i if mixed_index == str_key:
break index = i
break
if index is None: if index is None:
raise KeyError('No key found in dictionary') raise KeyError('No key found in dictionary')