From 56243e10c60ffdd5f4c25bc5821c0a64591acb7c Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Wed, 24 Sep 2014 17:48:11 +0200 Subject: [PATCH] The get_code generation of imports was buggy. --- jedi/parser/representation.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/jedi/parser/representation.py b/jedi/parser/representation.py index b3179793..fdc899dd 100644 --- a/jedi/parser/representation.py +++ b/jedi/parser/representation.py @@ -817,18 +817,17 @@ class Import(Simple): # in case one of the names is None alias = self.alias or '' - namespace = '.'.join(self.namespace_names) + ns_str = '.'.join(unicode(n) for n in self.namespace_names) if self.alias: - ns_str = "%s as %s" % ('.'.join(namespace), alias) - else: - ns_str = namespace + ns_str = "%s as %s" % (ns_str, alias) nl = '\n' if new_line else '' if self.from_names or self.relative_count: if self.star: ns_str = '*' dots = '.' * self.relative_count - return "from %s%s import %s%s" % (dots, '.'.join(self.from_names), ns_str, nl) + from_txt = '.'.join(unicode(n) for n in self.from_names) + return "from %s%s import %s%s" % (dots, from_txt, ns_str, nl) else: return "import %s%s" % (ns_str, nl)