diff --git a/jedi/evaluate/imports.py b/jedi/evaluate/imports.py index bc9c0e4a..7c10e5bc 100644 --- a/jedi/evaluate/imports.py +++ b/jedi/evaluate/imports.py @@ -335,7 +335,7 @@ class _Importer(object): content = common.source_to_unicode(f.read()) # these are strings that need to be used for namespace packages, # the first one is ``pkgutil``, the second ``pkg_resources``. - options = 'declare_namespace(__name__)', 'extend_path(__path__' + options = ('declare_namespace(__name__)', 'extend_path(__path__') if options[0] in content or options[1] in content: # It is a namespace, now try to find the rest of the modules. return follow_path(iter(import_path), sys.path) diff --git a/jedi/parser/representation.py b/jedi/parser/representation.py index fc812288..3227d108 100644 --- a/jedi/parser/representation.py +++ b/jedi/parser/representation.py @@ -1143,6 +1143,7 @@ isinstance(c, (tokenize.Token, Operator)) else unicode(c) else: # comments, strange tokens (like */**), error tokens to # reproduce the string correctly. + is_chain = False result.append(tok) return result diff --git a/test/completion/invalid.py b/test/completion/invalid.py index 832935b2..18233c20 100644 --- a/test/completion/invalid.py +++ b/test/completion/invalid.py @@ -157,3 +157,18 @@ def empty_assert(): x import datetime as + + +# ----------------- +# statements +# ----------------- + +call = '' +invalid = .call +#? str() +invalid + +call = '' +invalid = call?.call +#? str() +invalid