1
0
forked from VimPlug/jedi

introduced settings

This commit is contained in:
David Halter
2012-08-17 13:36:39 +02:00
parent 848b6e03eb
commit 1b310e9f90
2 changed files with 14 additions and 1 deletions

View File

@@ -9,6 +9,7 @@ working quite good.
import parsing import parsing
import evaluate import evaluate
import helpers import helpers
import settings
# This is something like the sys.path, but only for searching params. It means # This is something like the sys.path, but only for searching params. It means
# that this is the order in which Jedi searches params. # that this is the order in which Jedi searches params.
@@ -56,6 +57,9 @@ def search_params(param):
recursive madness. Therefore one has to analyse the statements that are recursive madness. Therefore one has to analyse the statements that are
calling the function, as well as analyzing the incoming params. calling the function, as well as analyzing the incoming params.
""" """
if not settings.dynamic_params:
return []
def get_params_for_module(module): def get_params_for_module(module):
""" """
Returns the values of a param, or an empty array. Returns the values of a param, or an empty array.
@@ -101,7 +105,7 @@ def search_params(param):
result = get_params_for_module(current_module) result = get_params_for_module(current_module)
# TODO check other modules # TODO check other modules
# cleanup: remove the listener, important should not stick. # cleanup: remove the listener; important: should not stick.
func.listeners.remove(listener) func.listeners.remove(listener)
return result return result
@@ -121,6 +125,8 @@ def _check_array_additions(compare_array, module, is_list):
>>> a = [""] >>> a = [""]
>>> a.append(1) >>> a.append(1)
""" """
if not settings.dynamic_array_additions:
return []
def scan_array(arr, search_name): def scan_array(arr, search_name):
""" Returns the function Calls that match func_name """ """ Returns the function Calls that match func_name """
result = [] result = []
@@ -185,6 +191,8 @@ def _check_array_additions(compare_array, module, is_list):
def check_array_instances(instance): def check_array_instances(instance):
if not settings.dynamic_arrays_instances:
return instance.var_args
ai = ArrayInstance(instance) ai = ArrayInstance(instance)
return helpers.generate_param_array([ai]) return helpers.generate_param_array([ai])
@@ -209,6 +217,7 @@ class ArrayInstance(parsing.Base):
if isinstance(array, evaluate.Instance) and len(array.var_args): if isinstance(array, evaluate.Instance) and len(array.var_args):
temp = array.var_args[0][0] temp = array.var_args[0][0]
if isinstance(temp, ArrayInstance): if isinstance(temp, ArrayInstance):
#print items, self, self.var_args, self.var_args.parent_stmt(), array
items += temp.iter_content() items += temp.iter_content()
continue continue
items += evaluate.get_iterator_types([array]) items += evaluate.get_iterator_types([array])

4
settings.py Normal file
View File

@@ -0,0 +1,4 @@
dynamic_arrays_instances = True
dynamic_array_additions = True
dynamic_params = True