mirror of
https://github.com/davidhalter/jedi.git
synced 2026-01-02 10:13:22 +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 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):
|
||||
"""
|
||||
See documentation of `self.is_nested_import`.
|
||||
@@ -252,7 +257,7 @@ class ImportPath(pr.Base):
|
||||
|
||||
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.insert(0, self.file_path)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user