forked from VimPlug/jedi
Remove the recursion detection in imports, because it's not needed there anymore.
This commit is contained in:
@@ -68,56 +68,49 @@ class ImportWrapper(tree.Base):
|
|||||||
|
|
||||||
@memoize_default()
|
@memoize_default()
|
||||||
def follow(self, is_goto=False):
|
def follow(self, is_goto=False):
|
||||||
if self._evaluator.recursion_detector.push_stmt(self._import):
|
module = self._evaluator.wrap(self._import.get_parent_until())
|
||||||
# check recursion
|
import_path = self._import.path_for_name(self._name)
|
||||||
return set()
|
from_import_name = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
module = self._evaluator.wrap(self._import.get_parent_until())
|
from_names = self._import.get_from_names()
|
||||||
import_path = self._import.path_for_name(self._name)
|
except AttributeError:
|
||||||
from_import_name = None
|
# Is an import_name
|
||||||
try:
|
pass
|
||||||
from_names = self._import.get_from_names()
|
else:
|
||||||
except AttributeError:
|
if len(from_names) + 1 == len(import_path):
|
||||||
# Is an import_name
|
# We have to fetch the from_names part first and then check
|
||||||
pass
|
# if from_names exists in the modules.
|
||||||
else:
|
from_import_name = import_path[-1]
|
||||||
if len(from_names) + 1 == len(import_path):
|
import_path = from_names
|
||||||
# We have to fetch the from_names part first and then check
|
|
||||||
# if from_names exists in the modules.
|
|
||||||
from_import_name = import_path[-1]
|
|
||||||
import_path = from_names
|
|
||||||
|
|
||||||
importer = Importer(self._evaluator, tuple(import_path),
|
importer = Importer(self._evaluator, tuple(import_path),
|
||||||
module, self._import.level)
|
module, self._import.level)
|
||||||
|
|
||||||
types = importer.follow()
|
types = importer.follow()
|
||||||
|
|
||||||
#if self._import.is_nested() and not self.nested_resolve:
|
#if self._import.is_nested() and not self.nested_resolve:
|
||||||
# scopes = [NestedImportModule(module, self._import)]
|
# scopes = [NestedImportModule(module, self._import)]
|
||||||
|
|
||||||
if from_import_name is not None:
|
if from_import_name is not None:
|
||||||
types = set(chain.from_iterable(
|
types = set(chain.from_iterable(
|
||||||
self._evaluator.find_types(t, unicode(from_import_name),
|
self._evaluator.find_types(t, unicode(from_import_name),
|
||||||
is_goto=is_goto)
|
is_goto=is_goto)
|
||||||
for t in types))
|
for t in types))
|
||||||
|
|
||||||
if not types:
|
if not types:
|
||||||
path = import_path + [from_import_name]
|
path = import_path + [from_import_name]
|
||||||
importer = Importer(self._evaluator, tuple(path),
|
importer = Importer(self._evaluator, tuple(path),
|
||||||
module, self._import.level)
|
module, self._import.level)
|
||||||
types = importer.follow()
|
types = importer.follow()
|
||||||
# goto only accepts `Name`
|
|
||||||
if is_goto:
|
|
||||||
types = set(s.name for s in types)
|
|
||||||
else:
|
|
||||||
# goto only accepts `Name`
|
# goto only accepts `Name`
|
||||||
if is_goto:
|
if is_goto:
|
||||||
types = set(s.name for s in types)
|
types = set(s.name for s in types)
|
||||||
|
else:
|
||||||
|
# goto only accepts `Name`
|
||||||
|
if is_goto:
|
||||||
|
types = set(s.name for s in types)
|
||||||
|
|
||||||
debug.dbg('after import: %s', types)
|
debug.dbg('after import: %s', types)
|
||||||
finally:
|
|
||||||
self._evaluator.recursion_detector.pop_stmt()
|
|
||||||
return types
|
return types
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -739,11 +739,12 @@ def _check_array_additions(evaluator, compare_array, module, is_list):
|
|||||||
# Check for recursion. Possible by using 'extend' in
|
# Check for recursion. Possible by using 'extend' in
|
||||||
# combination with function calls.
|
# combination with function calls.
|
||||||
continue
|
continue
|
||||||
if compare_array in evaluator.eval_element(power):
|
try:
|
||||||
# The arrays match. Now add the results
|
if compare_array in evaluator.eval_element(power):
|
||||||
added_types |= check_additions(execution_trailer.children[1], add_name)
|
# The arrays match. Now add the results
|
||||||
|
added_types |= check_additions(execution_trailer.children[1], add_name)
|
||||||
evaluator.recursion_detector.pop_stmt()
|
finally:
|
||||||
|
evaluator.recursion_detector.pop_stmt()
|
||||||
# reset settings
|
# reset settings
|
||||||
settings.dynamic_params_for_other_modules = temp_param_add
|
settings.dynamic_params_for_other_modules = temp_param_add
|
||||||
debug.dbg('Dynamic array result %s' % added_types, color='MAGENTA')
|
debug.dbg('Dynamic array result %s' % added_types, color='MAGENTA')
|
||||||
|
|||||||
Reference in New Issue
Block a user