diff --git a/jedi/api/classes.py b/jedi/api/classes.py index a1d42bd0..e5926ca8 100644 --- a/jedi/api/classes.py +++ b/jedi/api/classes.py @@ -322,7 +322,7 @@ class BaseDefinition(object): elif self._definition.isinstance(tree.Import): return imports.ImportWrapper(self._evaluator, self._name).follow() else: - return [self._definition] + return set([self._definition]) @property @memoize_default() @@ -331,7 +331,7 @@ class BaseDefinition(object): Raises an ``AttributeError``if the definition is not callable. Otherwise returns a list of `Definition` that represents the params. """ - followed = self._follow_statements_imports() + followed = list(self._follow_statements_imports()) if not followed or not hasattr(followed[0], 'py__call__'): raise AttributeError() followed = followed[0] # only check the first one. @@ -449,7 +449,7 @@ class Completion(BaseDefinition): followed = self._follow_statements_imports() if followed: # TODO: Use all of the followed objects as input to Documentation. - definition = followed[0] + definition = list(followed)[0] if raw: return _Help(definition).raw() diff --git a/jedi/evaluate/compiled/__init__.py b/jedi/evaluate/compiled/__init__.py index d1da59d0..a28fed7f 100644 --- a/jedi/evaluate/compiled/__init__.py +++ b/jedi/evaluate/compiled/__init__.py @@ -194,7 +194,7 @@ class CompiledObject(Base): if not result: try: for obj in self.obj: - result.append(CompiledObject(obj)) + result.add(CompiledObject(obj)) except TypeError: pass # self.obj maynot have an __iter__ method. return result diff --git a/test/test_evaluate/test_compiled.py b/test/test_evaluate/test_compiled.py index 2a6b28dc..c0977a48 100644 --- a/test/test_evaluate/test_compiled.py +++ b/test/test_evaluate/test_compiled.py @@ -12,7 +12,7 @@ def test_simple(): obj = compiled.CompiledObject('_str_', bltn) upper = e.find_types(obj, 'upper') assert len(upper) == 1 - objs = list(e.execute(upper[0])) + objs = list(e.execute(list(upper)[0])) assert len(objs) == 1 assert isinstance(objs[0], representation.Instance)