diff --git a/dynamic.py b/dynamic.py index 33f6608b..60e36f8a 100644 --- a/dynamic.py +++ b/dynamic.py @@ -111,6 +111,7 @@ def search_params(param): return result + def check_array_additions(array): """ Just a mapper function for the internal _check_array_additions """ if array._array.type not in ['list', 'set']: @@ -187,7 +188,6 @@ def _check_array_additions(compare_array, module, is_list): continue ass = stmt.get_assignment_calls() new_calls = scan_array(ass, add_name) - #print [c.start_pos for c in new_calls], stmt.start_pos result += check_calls(new_calls, add_name) evaluate.follow_statement.pop_stmt() continue diff --git a/evaluate.py b/evaluate.py index c2c91a22..c26abc0c 100644 --- a/evaluate.py +++ b/evaluate.py @@ -927,7 +927,7 @@ def get_scopes_for_name(scope, name_str, position=None, search_global=False): func = r.parent() # Instances are typically faked, if the instance is not # called from outside. Here we check it for __init__ - # functions and return + # functions and return. if isinstance(func, InstanceElement) \ and func.instance.is_generated \ and str(func.name) == '__init__' \ @@ -1177,8 +1177,6 @@ def follow_statement(stmt, seek_name=None): # Assignment checking is only important if the statement defines multiple # variables. if len(stmt.get_set_vars()) > 1 and seek_name and stmt.assignment_details: - # TODO This should have its own call_list, because call_list can also - # return 3 results for 2 variables. new_result = [] for op, set_vars in stmt.assignment_details: new_result += assign_tuples(set_vars, result, seek_name) diff --git a/helpers.py b/helpers.py index a69ab53f..65368750 100644 --- a/helpers.py +++ b/helpers.py @@ -75,7 +75,7 @@ class RecursionNode(object): and self.position == other.position and not self.is_ignored -def fast_parent_copy(obj): +def fast_parent_copy_old(obj): """ Much, much faster than deepcopy, but just for the elements in `classes`. """ @@ -107,12 +107,12 @@ def fast_parent_copy(obj): return copied_list return recursion(obj) -def fast_parent_copy2(obj): +def fast_parent_copy(obj): """ Much, much faster than deepcopy, but just for the elements in `classes`. """ new_elements = {} - classes = (parsing.Simple) + classes = (parsing.Simple, parsing.Call) def recursion(obj): new_obj = copy.copy(obj) @@ -141,11 +141,9 @@ def fast_parent_copy2(obj): copied_list[i] = recursion(el) elif isinstance(el, list): copied_list[i] = list_rec(el) - elif isinstance(el, parsing.Call): - copied_list[i] = fast_parent_copy(el) return copied_list return recursion(obj) - +fast_parent_copy2 = fast_parent_copy def generate_param_array(args_tuple, parent_stmt=None): """ This generates an array, that can be used as a param """ diff --git a/mixin/builtins.py b/mixin/builtins.py index 391d7c7d..6351d26c 100644 --- a/mixin/builtins.py +++ b/mixin/builtins.py @@ -160,9 +160,9 @@ class frozenset(): #-------------------------------------------------------- class int(): def __init__(self, x, base=None): - self.__x = x + pass class str(): def __init__(self, obj): - self.__obj = obj + pass diff --git a/test/completion/arrays.py b/test/completion/arrays.py index ccbd07a9..b74895df 100644 --- a/test/completion/arrays.py +++ b/test/completion/arrays.py @@ -229,3 +229,7 @@ tuple(list(set(a)))[1] tuple({1})[0] #? int() tuple((1,))[0] + +# implementation detail for lists, should not be visible +#? [] +list().__iterable diff --git a/test/completion/invalid.py b/test/completion/invalid.py index d8e9f36a..42ddb0cd 100644 --- a/test/completion/invalid.py +++ b/test/completion/invalid.py @@ -56,7 +56,7 @@ try: #? str() "" -# wrong ternary +# wrong ternary expression a = 1 if #? int() a diff --git a/test/completion/thirdparty/jedi_.py b/test/completion/thirdparty/jedi_.py index da6f1bb7..faa41bad 100644 --- a/test/completion/thirdparty/jedi_.py +++ b/test/completion/thirdparty/jedi_.py @@ -32,5 +32,6 @@ el = list(evaluate.get_names_for_scope(1))[0][1] el = list(evaluate.get_names_for_scope())[0][1] # TODO here should stand evaluate.Instance() and so on. +# need to understand list comprehensions #? el = list(evaluate.get_names_for_scope())[0][1][0]