diff --git a/jedi/api.py b/jedi/api.py index 4037cdd5..89a25eb0 100644 --- a/jedi/api.py +++ b/jedi/api.py @@ -426,7 +426,8 @@ class Script(object): This would return `None`. """ def check_user_stmt(user_stmt): - if user_stmt is None or not isinstance(user_stmt, parsing.Statement): + if user_stmt is None \ + or not isinstance(user_stmt, parsing.Statement): return None, 0 ass = helpers.fast_parent_copy(user_stmt.get_assignment_calls()) @@ -460,7 +461,6 @@ class Script(object): else: raise NotFoundError() - try: call, index = check_cache() except NotFoundError: diff --git a/jedi/helpers.py b/jedi/helpers.py index 646ecd5b..b93bf60f 100644 --- a/jedi/helpers.py +++ b/jedi/helpers.py @@ -246,4 +246,3 @@ def scan_array_for_pos(arr, pos): # The third return is just necessary for recursion inside, because # it needs to know when to stop iterating. return call, index, stop - diff --git a/jedi/modules.py b/jedi/modules.py index 91a22341..15b51039 100644 --- a/jedi/modules.py +++ b/jedi/modules.py @@ -70,7 +70,8 @@ class ModuleWithCursor(Module): self._parser = parsing.PyFuzzyParser(self.source, self.path, self.position) if self.path is not None: - builtin.CachedModule.cache[self.path] = time.time(), self._parser + builtin.CachedModule.cache[self.path] = time.time(), \ + self._parser return self._parser def get_path_until_cursor(self): diff --git a/test/regression.py b/test/regression.py index 797e8de8..bc4cb391 100755 --- a/test/regression.py +++ b/test/regression.py @@ -192,6 +192,13 @@ class TestRegression(unittest.TestCase): assert len(api.Script(s, 1, 15, '/').get_definition()) == 1 assert len(api.Script(s, 1, 10, '/').get_definition()) == 1 +class TestSpeed(unittest.TestCase): + def test_os_path_join(self): + """ named import - jedi-vim issue #8 """ + s = "join" + assert len(api.Script(s, 1, 15, '/').get_definition()) == 1 + assert len(api.Script(s, 1, 10, '/').get_definition()) == 1 + if __name__ == '__main__': unittest.main()