mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
cleaning / pep8
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
10
helpers.py
10
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 """
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -56,7 +56,7 @@ try:
|
||||
#? str()
|
||||
""
|
||||
|
||||
# wrong ternary
|
||||
# wrong ternary expression
|
||||
a = 1 if
|
||||
#? int()
|
||||
a
|
||||
|
||||
1
test/completion/thirdparty/jedi_.py
vendored
1
test/completion/thirdparty/jedi_.py
vendored
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user