From 86394a7ed5fb960dc669e477e76b28aad4df9672 Mon Sep 17 00:00:00 2001 From: David Halter Date: Sun, 11 Aug 2013 01:14:13 +0430 Subject: [PATCH] fix problems with imports as user_statement and brackets, fixes #285 --- jedi/api.py | 2 +- jedi/parsing.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/jedi/api.py b/jedi/api.py index e85c9373..a6d67d57 100644 --- a/jedi/api.py +++ b/jedi/api.py @@ -350,7 +350,7 @@ class Script(object): """ Used for goto_assignments and usages. - :param add_import_name: TODO add description + :param add_import_name: Add the the name (if import) to the result. """ def follow_inexistent_imports(defs): """ Imports can be generated, e.g. following diff --git a/jedi/parsing.py b/jedi/parsing.py index 2219d694..bf9f51e4 100644 --- a/jedi/parsing.py +++ b/jedi/parsing.py @@ -175,10 +175,10 @@ class Parser(object): while True: defunct = False token_type, tok = self.next() - if brackets and tok == '\n': - self.next() if tok == '(': # python allows only one `(` in the statement. brackets = True + token_type, tok = self.next() + if brackets and tok == '\n': self.next() i, token_type, tok = self._parse_dot_name(self._current) if not i: @@ -191,7 +191,6 @@ class Parser(object): token_type, tok = self.next() if not (tok == "," or brackets and tok == '\n'): break - print imports return imports def _parse_parentheses(self):