diff --git a/jedi/api.py b/jedi/api.py index ce6abfc0..79b3c066 100644 --- a/jedi/api.py +++ b/jedi/api.py @@ -121,7 +121,7 @@ class Script(object): for c in names: 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() if call_def: if not call_def.module.is_builtin(): diff --git a/jedi/evaluate_representation.py b/jedi/evaluate_representation.py index 5f3fb896..721bf360 100644 --- a/jedi/evaluate_representation.py +++ b/jedi/evaluate_representation.py @@ -838,16 +838,17 @@ class Array(use_metaclass(cache.CachedMetaClass, pr.Base)): for i, key_statement in enumerate(self._array.keys): # Because we only want the key to be a string. key_commands = key_statement.get_commands() - if len(key_commands) == 1: - key = key_commands[0] - key.get_code() - try: - str_key = key.get_code() - except AttributeError: - str_key = None - if mixed_index == str_key: - index = i - break + if len(key_commands) != 1: # cannot deal with complex strings + continue + key = key_commands[0] + if isinstance(key, pr.Call) and key.type == pr.Call.STRING: + str_key = key.name + elif isinstance(key, pr.Name): + str_key = str(key) + + if mixed_index == str_key: + index = i + break if index is None: raise KeyError('No key found in dictionary')