forked from VimPlug/jedi
Undo the tensorflow speedups, because they seem to cause more harm than good, see #1116
This commit is contained in:
@@ -208,32 +208,12 @@ class Script(object):
|
||||
:return: Completion objects, sorted by name and __ comes last.
|
||||
:rtype: list of :class:`classes.Completion`
|
||||
"""
|
||||
debug.speed('completions start')
|
||||
completion = Completion(
|
||||
self._evaluator, self._get_module(), self._code_lines,
|
||||
self._pos, self.call_signatures
|
||||
)
|
||||
completions = completion.completions()
|
||||
|
||||
def iter_import_completions():
|
||||
for c in completions:
|
||||
tree_name = c._name.tree_name
|
||||
if tree_name is None:
|
||||
continue
|
||||
definition = tree_name.get_definition()
|
||||
if definition is not None \
|
||||
and definition.type in ('import_name', 'import_from'):
|
||||
yield c
|
||||
|
||||
if len(list(iter_import_completions())) > 10:
|
||||
# For now disable completions if there's a lot of imports that
|
||||
# might potentially be resolved. This is the case for tensorflow
|
||||
# and has been fixed for it. This is obviously temporary until we
|
||||
# have a better solution.
|
||||
self._evaluator.infer_enabled = False
|
||||
|
||||
debug.speed('completions end')
|
||||
return completions
|
||||
with debug.increase_indent_cm('completions'):
|
||||
completion = Completion(
|
||||
self._evaluator, self._get_module(), self._code_lines,
|
||||
self._pos, self.call_signatures
|
||||
)
|
||||
return completion.completions()
|
||||
|
||||
def goto_definitions(self, **kwargs):
|
||||
"""
|
||||
|
||||
@@ -115,9 +115,6 @@ class Evaluator(object):
|
||||
self.is_analysis = False
|
||||
self.project = project
|
||||
self.access_cache = {}
|
||||
# This setting is only temporary to limit the work we have to do with
|
||||
# tensorflow and others.
|
||||
self.infer_enabled = True
|
||||
|
||||
self.reset_recursion_limitations()
|
||||
self.allow_different_encoding = True
|
||||
@@ -165,9 +162,6 @@ class Evaluator(object):
|
||||
return self.project._get_sys_path(self, environment=self.environment, **kwargs)
|
||||
|
||||
def eval_element(self, context, element):
|
||||
if not self.infer_enabled:
|
||||
return NO_CONTEXTS
|
||||
|
||||
if isinstance(context, CompForContext):
|
||||
return eval_node(context, element)
|
||||
|
||||
|
||||
@@ -277,8 +277,7 @@ class Importer(object):
|
||||
return sys_path_mod
|
||||
|
||||
def follow(self):
|
||||
if not self.import_path or not self._evaluator.infer_enabled \
|
||||
or not self._inference_possible:
|
||||
if not self.import_path or not self._inference_possible:
|
||||
return NO_CONTEXTS
|
||||
|
||||
import_names = tuple(
|
||||
|
||||
Reference in New Issue
Block a user