From 39f43c52fe7c089ba5d6eca5c92b8430849e7ba3 Mon Sep 17 00:00:00 2001 From: David Halter Date: Fri, 8 Feb 2013 12:49:36 +0100 Subject: [PATCH] little fixes for the dynamic module --- jedi/dynamic.py | 8 ++++---- jedi/evaluate.py | 2 +- jedi/evaluate_representation.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/jedi/dynamic.py b/jedi/dynamic.py index 7e8034d5..7bc507c8 100644 --- a/jedi/dynamic.py +++ b/jedi/dynamic.py @@ -182,12 +182,12 @@ def search_params(param): def check_array_additions(array): """ Just a mapper function for the internal _check_array_additions """ - if array._array.type not in ['list', 'set']: + if not pr.Array.is_type(array._array, pr.Array.LIST, pr.Array.SET): # TODO also check for dict updates return [] is_list = array._array.type == 'list' - current_module = array._array.parent_stmt.get_parent_until() + current_module = array._array.get_parent_until() res = _check_array_additions(array, current_module, is_list) return res @@ -264,10 +264,10 @@ def _check_array_additions(compare_array, module, is_list): def get_execution_parent(element, *stop_classes): """ Used to get an Instance/Execution parent """ if isinstance(element, er.Array): - stmt = element._array.parent_stmt + stmt = element._array.parent else: # must be instance - stmt = element.var_args.parent_stmt + stmt = element.var_args.parent if isinstance(stmt, er.InstanceElement): stop_classes = list(stop_classes) + [er.Function] return stmt.get_parent_until(stop_classes) diff --git a/jedi/evaluate.py b/jedi/evaluate.py index 7cc4062c..7a6bc069 100644 --- a/jedi/evaluate.py +++ b/jedi/evaluate.py @@ -661,7 +661,7 @@ def follow_call_path(path, scope, position): debug.warning('unknown type:', current.type, current) scopes = [] # Make instances of those number/string objects. - scopes = [er.Instance(s, [current.name]) for s in scopes] + scopes = [er.Instance(s, (current.name,)) for s in scopes] result = imports.strip_imports(scopes) return follow_paths(path, result, scope, position=position) diff --git a/jedi/evaluate_representation.py b/jedi/evaluate_representation.py index 95b5acbe..6da69271 100644 --- a/jedi/evaluate_representation.py +++ b/jedi/evaluate_representation.py @@ -53,7 +53,7 @@ class Executable(pr.Base): class Instance(use_metaclass(cache.CachedMetaClass, Executable)): """ This class is used to evaluate instances. """ - def __init__(self, base, var_args=None): + def __init__(self, base, var_args=[]): super(Instance, self).__init__(base, var_args) if str(base.name) in ['list', 'set'] \ and builtin.Builtin.scope == base.get_parent_until(): @@ -336,7 +336,7 @@ class Function(use_metaclass(cache.CachedMetaClass, pr.Base)): # Create param array. old_func = Function(f, is_decorated=True) - wrappers = Execution(decorator, [old_func]).get_return_types() + wrappers = Execution(decorator, (old_func,)).get_return_types() if not len(wrappers): debug.warning('no wrappers found', self.base_func) return None