forked from VimPlug/jedi
Don't use stub_to_python_context_set anymore
This commit is contained in:
@@ -11,7 +11,7 @@ from jedi.evaluate import imports
|
||||
from jedi.api import keywords
|
||||
from jedi.evaluate.helpers import evaluate_call_of_leaf, parse_dotted_names
|
||||
from jedi.evaluate.filters import get_global_filters
|
||||
from jedi.evaluate.gradual.conversion import stub_to_python_context_set
|
||||
from jedi.evaluate.gradual.conversion import convert_contexts
|
||||
from jedi.parser_utils import get_statement_of_position
|
||||
|
||||
|
||||
@@ -246,12 +246,9 @@ class Completion:
|
||||
origin_scope=user_context.tree_node):
|
||||
completion_names += filter.values()
|
||||
|
||||
for context in contexts:
|
||||
if not context.is_stub():
|
||||
continue
|
||||
|
||||
actual_contexts = stub_to_python_context_set(context, ignore_compiled=True)
|
||||
for c in actual_contexts:
|
||||
python_contexts = convert_contexts(contexts)
|
||||
for c in python_contexts:
|
||||
if c not in contexts:
|
||||
for filter in c.get_filters(
|
||||
search_global=False,
|
||||
origin_scope=user_context.tree_node):
|
||||
|
||||
@@ -29,7 +29,7 @@ from jedi.evaluate.filters import get_global_filters
|
||||
from jedi.evaluate.names import TreeNameDefinition
|
||||
from jedi.evaluate.base_context import ContextSet, NO_CONTEXTS
|
||||
from jedi.parser_utils import is_scope, get_parent_scope
|
||||
from jedi.evaluate.gradual.conversion import stub_to_python_context_set
|
||||
from jedi.evaluate.gradual.conversion import convert_contexts
|
||||
|
||||
|
||||
class NameFinder(object):
|
||||
@@ -123,8 +123,7 @@ class NameFinder(object):
|
||||
yield f
|
||||
# This covers the case where a stub files are incomplete.
|
||||
if self._context.is_stub():
|
||||
contexts = stub_to_python_context_set(self._context, ignore_compiled=True)
|
||||
for c in contexts:
|
||||
for c in convert_contexts(ContextSet({self._context})):
|
||||
for f in c.get_filters():
|
||||
yield f
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from jedi.evaluate.utils import to_list
|
||||
from jedi.evaluate.gradual.stub_context import StubModuleContext
|
||||
|
||||
|
||||
def stub_to_python_context_set(stub_context, ignore_compiled=False):
|
||||
def _stub_to_python_context_set(stub_context, ignore_compiled=False):
|
||||
stub_module = stub_context.get_root_context()
|
||||
if not stub_module.is_stub():
|
||||
return ContextSet([stub_context])
|
||||
@@ -146,7 +146,7 @@ def convert_contexts(contexts, only_stubs=False, prefer_stubs=False, ignore_comp
|
||||
)
|
||||
else:
|
||||
return ContextSet.from_sets(
|
||||
stub_to_python_context_set(stub_context, ignore_compiled=ignore_compiled)
|
||||
_stub_to_python_context_set(stub_context, ignore_compiled=ignore_compiled)
|
||||
or ContextSet({stub_context})
|
||||
for stub_context in contexts
|
||||
)
|
||||
|
||||
@@ -356,12 +356,9 @@ class Importer(object):
|
||||
names += context.sub_modules_dict().values()
|
||||
|
||||
if not only_modules:
|
||||
from jedi.evaluate.gradual.conversion import stub_to_python_context_set
|
||||
both_contexts = ContextSet.from_sets(
|
||||
stub_to_python_context_set(context, ignore_compiled=True)
|
||||
for context in contexts
|
||||
if context.is_stub()
|
||||
) | contexts
|
||||
from jedi.evaluate.gradual.conversion import convert_contexts
|
||||
|
||||
both_contexts = contexts | convert_contexts(contexts)
|
||||
for c in both_contexts:
|
||||
for filter in c.get_filters(search_global=False):
|
||||
names += filter.values()
|
||||
|
||||
Reference in New Issue
Block a user