This commit is contained in:
David Halter
2012-10-21 14:33:14 +02:00
parent 51cfb43716
commit 99739754ef
4 changed files with 11 additions and 4 deletions

View File

@@ -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:

View File

@@ -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

View File

@@ -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):

View File

@@ -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()