forked from VimPlug/jedi
strip_imports -> follow_imports
This commit is contained in:
@@ -316,7 +316,7 @@ class BaseDefinition(object):
|
|||||||
if stripped.isinstance(pr.Statement):
|
if stripped.isinstance(pr.Statement):
|
||||||
return self._evaluator.eval_statement(stripped)
|
return self._evaluator.eval_statement(stripped)
|
||||||
elif stripped.isinstance(pr.Import):
|
elif stripped.isinstance(pr.Import):
|
||||||
return imports.strip_imports(self._evaluator, [stripped])
|
return imports.follow_imports(self._evaluator, [stripped])
|
||||||
else:
|
else:
|
||||||
return [stripped]
|
return [stripped]
|
||||||
|
|
||||||
|
|||||||
@@ -230,7 +230,7 @@ class Evaluator(object):
|
|||||||
else:
|
else:
|
||||||
# for pr.Literal
|
# for pr.Literal
|
||||||
types = [compiled.create(self, current.value)]
|
types = [compiled.create(self, current.value)]
|
||||||
types = imports.strip_imports(self, types)
|
types = imports.follow_imports(self, types)
|
||||||
|
|
||||||
return self.follow_path(path, types, scope)
|
return self.follow_path(path, types, scope)
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ class Evaluator(object):
|
|||||||
if filter_private_variable(typ, scope, current):
|
if filter_private_variable(typ, scope, current):
|
||||||
return []
|
return []
|
||||||
types = self.find_types(typ, current)
|
types = self.find_types(typ, current)
|
||||||
result = imports.strip_imports(self, types)
|
result = imports.follow_imports(self, types)
|
||||||
return self.follow_path(path, result, scope)
|
return self.follow_path(path, result, scope)
|
||||||
|
|
||||||
@debug.increase_indent
|
@debug.increase_indent
|
||||||
@@ -330,7 +330,7 @@ class Evaluator(object):
|
|||||||
debug.warning("no execution possible %s", obj)
|
debug.warning("no execution possible %s", obj)
|
||||||
|
|
||||||
debug.dbg('execute result: %s in %s', stmts, obj)
|
debug.dbg('execute result: %s in %s', stmts, obj)
|
||||||
return imports.strip_imports(self, stmts)
|
return imports.follow_imports(self, stmts)
|
||||||
|
|
||||||
def goto(self, stmt, call_path):
|
def goto(self, stmt, call_path):
|
||||||
scope = stmt.get_parent_until(pr.IsScope)
|
scope = stmt.get_parent_until(pr.IsScope)
|
||||||
|
|||||||
@@ -458,7 +458,7 @@ class _Importer(object):
|
|||||||
return load_module(name=path), rest
|
return load_module(name=path), rest
|
||||||
|
|
||||||
|
|
||||||
def strip_imports(evaluator, scopes):
|
def follow_imports(evaluator, scopes):
|
||||||
"""
|
"""
|
||||||
Here we strip the imports - they don't get resolved necessarily.
|
Here we strip the imports - they don't get resolved necessarily.
|
||||||
Really used anymore? Merge with remove_star_imports?
|
Really used anymore? Merge with remove_star_imports?
|
||||||
@@ -483,7 +483,7 @@ def remove_star_imports(evaluator, scope, ignored_modules=()):
|
|||||||
"""
|
"""
|
||||||
if isinstance(scope, StarImportModule):
|
if isinstance(scope, StarImportModule):
|
||||||
return scope.star_import_modules
|
return scope.star_import_modules
|
||||||
modules = strip_imports(evaluator, (i for i in scope.get_imports() if i.star))
|
modules = follow_imports(evaluator, (i for i in scope.get_imports() if i.star))
|
||||||
new = []
|
new = []
|
||||||
for m in modules:
|
for m in modules:
|
||||||
if m not in ignored_modules:
|
if m not in ignored_modules:
|
||||||
|
|||||||
@@ -784,7 +784,7 @@ class Import(Simple):
|
|||||||
import foo.bar
|
import foo.bar
|
||||||
"""
|
"""
|
||||||
return not self.alias and not self.from_ns \
|
return not self.alias and not self.from_ns \
|
||||||
and len(self.namespace.names) > 1 \
|
and len(self.namespace.names) > 1
|
||||||
|
|
||||||
|
|
||||||
class KeywordStatement(Base):
|
class KeywordStatement(Base):
|
||||||
|
|||||||
Reference in New Issue
Block a user