mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 23:04:48 +08:00
More issues from the list of types to set of types conversion.
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user