diff --git a/jedi/evaluate/imports.py b/jedi/evaluate/imports.py index ddc5f68b..4db6d66a 100644 --- a/jedi/evaluate/imports.py +++ b/jedi/evaluate/imports.py @@ -167,7 +167,8 @@ class ImportPath(pr.Base): # This is not an existing Import statement. Therefore, set position to # 0 (0 is not a valid line number). zero = (0, 0) - names = i.namespace.names[1:] + names = ((name_part.string, name_part.start_pos) + for name_part in i.namespace.names[1:]) n = pr.Name(i._sub_module, names, zero, zero, self.import_stmt) new = pr.Import(i._sub_module, zero, zero, n) new.parent = parent diff --git a/jedi/parser/representation.py b/jedi/parser/representation.py index 61a42679..e68a7c89 100644 --- a/jedi/parser/representation.py +++ b/jedi/parser/representation.py @@ -1433,8 +1433,7 @@ class Name(Simple): def __init__(self, module, names, start_pos, end_pos, parent=None): super(Name, self).__init__(module, start_pos, end_pos) - names = tuple(n if isinstance(n, NamePart) else - NamePart(n[0], self, n[1]) for n in names) + names = tuple(NamePart(n[0], self, n[1]) for n in names) # Cache get_code, because it's used quite often for comparisons # (seen by using the profiler). self._get_code = ".".join(unicode(n) for n in names)