diff --git a/jedi/evaluate.py b/jedi/evaluate.py index 7a17b946..3a0eacdf 100644 --- a/jedi/evaluate.py +++ b/jedi/evaluate.py @@ -1138,7 +1138,10 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False, if name_str == name.get_code() and p not in break_scopes: r, no_break_scope = process(name) if is_goto: - result.append(name) + if r: + # Directly assign the name, but there has to be a + # result. + result.append(name) else: result += r # for comparison we need the raw class diff --git a/jedi/parsing.py b/jedi/parsing.py index b6ab611b..9e7d2471 100644 --- a/jedi/parsing.py +++ b/jedi/parsing.py @@ -1508,7 +1508,7 @@ class PyFuzzyParser(object): string += ' ' string += ".".join(n.names) continue - elif tok.endswith('=') and not tok in ['>=', '<=', '==', '!=']: + elif tok.endswith('=') and tok not in ['>=', '<=', '==', '!=']: # there has been an assignement -> change vars if level == 0: set_vars = used_vars @@ -1518,10 +1518,7 @@ class PyFuzzyParser(object): elif tok in closing_brackets: level -= 1 - if set_string is not None: - string = set_string - else: - string += tok + string = set_string if set_string is not None else string + tok token_type, tok = self.next() except StopIteration: # comes from tokenizer diff --git a/test/completion/renaming.py b/test/completion/renaming.py index 5f9bacd7..94e18e80 100644 --- a/test/completion/renaming.py +++ b/test/completion/renaming.py @@ -90,7 +90,7 @@ from import_tree.rename1 import not_existing -response = 3 +response = 5 #< 0 (95, 0), (96, 0), (97, 0), (99, 0) response = HttpResponse(mimetype='application/pdf') response['Content-Disposition'] = 'attachment; filename=%s.pdf' % id