mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
mainly settings documentation
This commit is contained in:
@@ -5,7 +5,6 @@ follow_statement -> follow_call -> follow_paths -> follow_path
|
|||||||
`get_names_for_scope` and `get_scopes_for_name` are search functions
|
`get_names_for_scope` and `get_scopes_for_name` are search functions
|
||||||
|
|
||||||
TODO doc
|
TODO doc
|
||||||
TODO list comprehensions, priority? +1
|
|
||||||
TODO magic methods: __mul__, __add__, etc.
|
TODO magic methods: __mul__, __add__, etc.
|
||||||
TODO evaluate asserts/isinstance (type safety)
|
TODO evaluate asserts/isinstance (type safety)
|
||||||
|
|
||||||
@@ -199,6 +198,9 @@ class Instance(Executable):
|
|||||||
add_self_dot_name(n)
|
add_self_dot_name(n)
|
||||||
|
|
||||||
for s in self.base.get_super_classes():
|
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()
|
names += Instance(s).get_self_properties()
|
||||||
|
|
||||||
return names
|
return names
|
||||||
|
|||||||
10
helpers.py
10
helpers.py
@@ -88,11 +88,8 @@ class ExecutionRecursionDecorator(object):
|
|||||||
self.reset()
|
self.reset()
|
||||||
|
|
||||||
def __call__(self, execution, evaluate_generator=False):
|
def __call__(self, execution, evaluate_generator=False):
|
||||||
#print execution, self.recursion_level, self.execution_count,
|
#print execution, self.recursion_level, self.execution_count, len(self.execution_funcs), a
|
||||||
#print len(self.execution_funcs),
|
if self.check_recursion(execution, evaluate_generator):
|
||||||
a= self.check_recursion(execution, evaluate_generator)
|
|
||||||
#print a
|
|
||||||
if a:
|
|
||||||
result = []
|
result = []
|
||||||
else:
|
else:
|
||||||
result = self.func(execution, evaluate_generator)
|
result = self.func(execution, evaluate_generator)
|
||||||
@@ -162,8 +159,9 @@ def fast_parent_copy(obj):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
if hasattr(obj, 'parent_stmt') and obj.parent_stmt is not None:
|
if hasattr(obj, 'parent_stmt') and obj.parent_stmt is not None:
|
||||||
|
p = obj.parent_stmt()
|
||||||
try:
|
try:
|
||||||
new_obj.parent_stmt = weakref.ref(new_elements[obj.parent_stmt()])
|
new_obj.parent_stmt = weakref.ref(new_elements[p])
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
28
settings.py
28
settings.py
@@ -2,14 +2,40 @@
|
|||||||
# dynamic stuff
|
# dynamic stuff
|
||||||
# ----------------
|
# ----------------
|
||||||
|
|
||||||
|
# check for `append`, etc. on array instances like list()
|
||||||
dynamic_arrays_instances = True
|
dynamic_arrays_instances = True
|
||||||
|
# check for `append`, etc. on arrays: [], {}, ()
|
||||||
dynamic_array_additions = True
|
dynamic_array_additions = True
|
||||||
|
|
||||||
|
# A dynamic param completion, finds the callees of the function, which define
|
||||||
|
# the params of a function.
|
||||||
dynamic_params = True
|
dynamic_params = True
|
||||||
|
|
||||||
# ----------------
|
# ----------------
|
||||||
# recursions
|
# 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_function_recursion_level = 5
|
||||||
max_until_execution_unique = 50
|
max_until_execution_unique = 50
|
||||||
max_executions = 5000
|
max_executions = 1000
|
||||||
|
|||||||
6
test/completion/thirdparty/jedi_.py
vendored
6
test/completion/thirdparty/jedi_.py
vendored
@@ -45,5 +45,9 @@ el = list(evaluate.get_names_for_scope())[0][1][0]
|
|||||||
#? evaluate.Array() evaluate.Class() evaluate.Function() evaluate.Instance()
|
#? evaluate.Array() evaluate.Class() evaluate.Function() evaluate.Instance()
|
||||||
list(evaluate.follow_call())[0]
|
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]
|
evaluate.get_scopes_for_name()[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user