From 0a0673e87c64378fb99966217ed8b10792fba9ca Mon Sep 17 00:00:00 2001 From: Dave Halter Date: Mon, 4 Aug 2014 01:39:05 +0200 Subject: [PATCH] refactoring in dynamic param searching --- jedi/evaluate/dynamic.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/jedi/evaluate/dynamic.py b/jedi/evaluate/dynamic.py index 6818b827..787513ea 100644 --- a/jedi/evaluate/dynamic.py +++ b/jedi/evaluate/dynamic.py @@ -80,8 +80,8 @@ def search_params(evaluator, param): # This whole stuff is just to not execute certain parts # (speed improvement), basically we could just call - # ``eval_call_path`` on the call_path and it would - # also work. + # ``eval_call_path`` on the call_path and it would also + # work. def listRightIndex(lst, value): return len(lst) - lst[-1::-1].index(value) - 1 @@ -90,12 +90,12 @@ def search_params(evaluator, param): call_path_simple = [unicode(d) if isinstance(d, pr.NamePart) else d for d in call_path] i = listRightIndex(call_path_simple, func_name) - first, last = call_path[:i], call_path[i + 1:] - if not last and not call_path_simple.index(func_name) != i: + before, after = call_path[:i], call_path[i + 1:] + if not after and not call_path_simple.index(func_name) != i: continue scopes = [scope] - if first: - scopes = evaluator.eval_call_path(iter(first), c.parent, pos) + if before: + scopes = evaluator.eval_call_path(iter(before), c.parent, pos) pos = None from jedi.evaluate import representation as er for scope in scopes: @@ -105,7 +105,7 @@ def search_params(evaluator, param): # doesn't matter. But this is a way to get potential # candidates for calling that function really quick! s = evaluator.find_types(scope, func_name, position=pos, - search_global=not first, + search_global=not before, resolve_decorator=False) c = [getattr(escope, 'base_func', None) or escope.base @@ -114,7 +114,7 @@ def search_params(evaluator, param): if compare in c: # only if we have the correct function we execute # it, otherwise just ignore it. - evaluator.follow_path(iter(last), s, scope) + evaluator.follow_path(iter(after), s, scope) return listener.param_possibilities result = []