mirror of
https://github.com/davidhalter/jedi.git
synced 2026-08-12 19:24:39 +08:00
fix problem with empty import_paths
This commit is contained in:
+5
-4
@@ -151,10 +151,11 @@ class ImportPath(parsing.Base):
|
|||||||
# sys.path. Therefore look if gunicorn is a parent directory, #56.
|
# sys.path. Therefore look if gunicorn is a parent directory, #56.
|
||||||
parts = self.file_path.split(os.path.sep)
|
parts = self.file_path.split(os.path.sep)
|
||||||
in_path = []
|
in_path = []
|
||||||
for i, p in enumerate(parts):
|
if self.import_path:
|
||||||
if p == self.import_path[0]:
|
for i, p in enumerate(parts):
|
||||||
new = os.path.sep.join(parts[:i])
|
if p == self.import_path[0]:
|
||||||
in_path.append(new)
|
new = os.path.sep.join(parts[:i])
|
||||||
|
in_path.append(new)
|
||||||
|
|
||||||
module = self.import_stmt.get_parent_until()
|
module = self.import_stmt.get_parent_until()
|
||||||
return in_path + modules.sys_path_with_modifications(module)
|
return in_path + modules.sys_path_with_modifications(module)
|
||||||
|
|||||||
Reference in New Issue
Block a user