From 926ab81bf222815f3a0470f0b50756d2135b4671 Mon Sep 17 00:00:00 2001 From: David Halter Date: Tue, 19 Feb 2013 00:11:15 +0430 Subject: [PATCH] some import fixes --- jedi/imports.py | 4 ++-- jedi/modules.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/jedi/imports.py b/jedi/imports.py index 19c13e9b..b0e9b3b4 100644 --- a/jedi/imports.py +++ b/jedi/imports.py @@ -101,8 +101,8 @@ class ImportPath(pr.Base): # 0 (0 is not a valid line number). zero = (0, 0) names = i.namespace.names[1:] - n = pr.Name(i.module, names, zero, zero, self.import_stmt) - new = pr.Import(i.module, zero, zero, n) + n = pr.Name(i._sub_module, names, zero, zero, self.import_stmt) + new = pr.Import(i._sub_module, zero, zero, n) new.parent = parent debug.dbg('Generated a nested import: %s' % new) return new diff --git a/jedi/modules.py b/jedi/modules.py index b82cb349..844a1eb9 100644 --- a/jedi/modules.py +++ b/jedi/modules.py @@ -314,7 +314,8 @@ def sys_path_with_modifications(module): if not isinstance(p, pr.Statement): continue commands = p.get_commands() - assert len(commands) == 1 + if len(commands) != 1: # sys.path command is just one thing. + continue call = commands[0] n = call.name if not isinstance(n, pr.Name) or len(n.names) != 3: