1
0
forked from VimPlug/jedi

Prefer stubs to Python names when starting to infer

This commit is contained in:
Dave Halter
2019-06-13 09:26:50 +02:00
parent a0adff9d36
commit 5a26d4cf8f
2 changed files with 15 additions and 7 deletions

View File

@@ -309,14 +309,18 @@ class BaseDefinition(object):
if not self._name.is_context_name:
return []
# First we need to make sure that we have stub names (if possible) that
# we can follow. If we don't do that, we can end up with the inferred
# results of Python objects instead of stubs.
names = convert_names([self._name], prefer_stubs=True)
contexts = convert_contexts(
self._name.infer(),
ContextSet.from_sets(n.infer() for n in names),
only_stubs=only_stubs,
prefer_stubs=prefer_stubs,
)
names = [c.name for c in contexts]
resulting_names = [c.name for c in contexts]
return [self if n == self._name else Definition(self._evaluator, n)
for n in names]
for n in resulting_names]
@property
@memoize_method