mirror of
https://github.com/davidhalter/jedi.git
synced 2026-02-18 13:54:14 +08:00
Don't mess with the path if the import is absolute
This commit is contained in:
@@ -91,6 +91,11 @@ class ImportPath(pr.Base):
|
|||||||
and len(self.import_stmt.namespace.names) > 1 \
|
and len(self.import_stmt.namespace.names) > 1 \
|
||||||
and not self.direct_resolve
|
and not self.direct_resolve
|
||||||
|
|
||||||
|
@property
|
||||||
|
def is_absolute(self):
|
||||||
|
module = self.import_stmt.get_parent_until(pr.IsScope)
|
||||||
|
return module.absolute_imports
|
||||||
|
|
||||||
def get_nested_import(self, parent):
|
def get_nested_import(self, parent):
|
||||||
"""
|
"""
|
||||||
See documentation of `self.is_nested_import`.
|
See documentation of `self.is_nested_import`.
|
||||||
@@ -252,7 +257,7 @@ class ImportPath(pr.Base):
|
|||||||
|
|
||||||
return importing
|
return importing
|
||||||
|
|
||||||
if self.file_path:
|
if self.file_path and not self.is_absolute:
|
||||||
sys_path_mod = list(self.sys_path_with_modifications())
|
sys_path_mod = list(self.sys_path_with_modifications())
|
||||||
sys_path_mod.insert(0, self.file_path)
|
sys_path_mod.insert(0, self.file_path)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user