forked from VimPlug/jedi
This commit is contained in:
@@ -202,6 +202,13 @@ class ImportPath(pr.Base):
|
|||||||
# follow the rest of the import (not FS -> classes, functions)
|
# follow the rest of the import (not FS -> classes, functions)
|
||||||
if len(rest) > 1 or rest and self.is_like_search:
|
if len(rest) > 1 or rest and self.is_like_search:
|
||||||
scopes = []
|
scopes = []
|
||||||
|
if ['os', 'path'] == self.import_path[:2] \
|
||||||
|
and not self.is_relative_import():
|
||||||
|
# This is a huge exception, we follow a nested import
|
||||||
|
# ``os.path``, because it's a very important one in Python
|
||||||
|
# that is being achieved by messing with ``sys.modules`` in
|
||||||
|
# ``os``.
|
||||||
|
scopes = evaluate.follow_path(iter(rest), scope, scope)
|
||||||
elif rest:
|
elif rest:
|
||||||
if is_goto:
|
if is_goto:
|
||||||
scopes = itertools.chain.from_iterable(
|
scopes = itertools.chain.from_iterable(
|
||||||
@@ -222,6 +229,9 @@ class ImportPath(pr.Base):
|
|||||||
evaluate.follow_statement.pop_stmt()
|
evaluate.follow_statement.pop_stmt()
|
||||||
return scopes
|
return scopes
|
||||||
|
|
||||||
|
def is_relative_import(self):
|
||||||
|
return bool(self.import_stmt.relative_count)
|
||||||
|
|
||||||
def get_relative_path(self):
|
def get_relative_path(self):
|
||||||
path = self.file_path
|
path = self.file_path
|
||||||
for i in range(self.import_stmt.relative_count - 1):
|
for i in range(self.import_stmt.relative_count - 1):
|
||||||
|
|||||||
Reference in New Issue
Block a user