1
0
forked from VimPlug/jedi

little fixes for the dynamic module

This commit is contained in:
David Halter
2013-02-08 12:49:36 +01:00
parent 94126edda8
commit 39f43c52fe
3 changed files with 7 additions and 7 deletions

View File

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

View File

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

View File

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