mainly settings documentation

This commit is contained in:
David Halter
2012-08-30 01:41:40 +02:00
parent 9c9f17a2b7
commit dd0cc343f8
4 changed files with 39 additions and 9 deletions

View File

@@ -5,7 +5,6 @@ follow_statement -> follow_call -> follow_paths -> follow_path
`get_names_for_scope` and `get_scopes_for_name` are search functions
TODO doc
TODO list comprehensions, priority? +1
TODO magic methods: __mul__, __add__, etc.
TODO evaluate asserts/isinstance (type safety)
@@ -199,6 +198,9 @@ class Instance(Executable):
add_self_dot_name(n)
for s in self.base.get_super_classes():
if s == self.base:
# I don't know how this could happen... But saw it once.
continue
names += Instance(s).get_self_properties()
return names

View File

@@ -88,11 +88,8 @@ class ExecutionRecursionDecorator(object):
self.reset()
def __call__(self, execution, evaluate_generator=False):
#print execution, self.recursion_level, self.execution_count,
#print len(self.execution_funcs),
a= self.check_recursion(execution, evaluate_generator)
#print a
if a:
#print execution, self.recursion_level, self.execution_count, len(self.execution_funcs), a
if self.check_recursion(execution, evaluate_generator):
result = []
else:
result = self.func(execution, evaluate_generator)
@@ -162,8 +159,9 @@ def fast_parent_copy(obj):
pass
if hasattr(obj, 'parent_stmt') and obj.parent_stmt is not None:
p = obj.parent_stmt()
try:
new_obj.parent_stmt = weakref.ref(new_elements[obj.parent_stmt()])
new_obj.parent_stmt = weakref.ref(new_elements[p])
except KeyError:
pass

View File

@@ -2,14 +2,40 @@
# dynamic stuff
# ----------------
# check for `append`, etc. on array instances like list()
dynamic_arrays_instances = True
# check for `append`, etc. on arrays: [], {}, ()
dynamic_array_additions = True
# A dynamic param completion, finds the callees of the function, which define
# the params of a function.
dynamic_params = True
# ----------------
# recursions
# ----------------
# Recursion settings are important if you don't want extremly recursive python
# code to go absolutely crazy. First of there is a global limit
# `max_executions`. This limit is important, to set a maximum amount of time,
# the completion may use.
#
# The `max_until_execution_unique` limit is probably the most important one,
# because if that limit is passed, functions can only be one time executed. So
# new functions will be executed, complex recursions with the same functions
# again and again, are ignored.
#
# `max_function_recursion_level` is more about whether the recursions are
# stopped in deepth or in width. The ratio beetween this and
# `max_until_execution_unique` is important here. It stops a recursion (after
# the number of function calls in the recursion), if it was already used
# earlier.
#
# The values are based on my experimental tries, used on the jedi library. But
# I don't think there's any other Python library, that uses recursion in a
# similar (extreme) way. This makes the completion definitely worse in some
# cases. But a completion should also be fast.
max_function_recursion_level = 5
max_until_execution_unique = 50
max_executions = 5000
max_executions = 1000

View File

@@ -45,5 +45,9 @@ el = list(evaluate.get_names_for_scope())[0][1][0]
#? evaluate.Array() evaluate.Class() evaluate.Function() evaluate.Instance()
list(evaluate.follow_call())[0]
#? evaluate.Array() evaluate.Class() evaluate.Function() evaluate.Instance()
# With the right recursion settings, this should be possible (and maybe more):
# Array Class Function Generator Instance Module
# However, this was produced with the recursion settings 10/350/10000, and
# lasted 18.5 seconds. So we just have to be content with the results.
#? evaluate.Class() evaluate.Function()
evaluate.get_scopes_for_name()[0]