param arguments that are being forgotten by the user are now added (no strange behaviour anymore)

This commit is contained in:
David Halter
2012-11-30 18:00:48 +01:00
parent 447ae46b2f
commit b571964939
3 changed files with 17 additions and 4 deletions

View File

@@ -600,6 +600,7 @@ class Execution(Executable):
var_arg_iterator = self.get_var_args_iterator()
non_matching_keys = []
keys_used = set()
keys_only = False
for param in self.base.params[start_offset:]:
# The value and key can both be null. There, the defaults apply.
@@ -609,15 +610,16 @@ class Execution(Executable):
# completions.
key, value = next(var_arg_iterator, (None, None))
while key:
keys_only = True
try:
key_param = param_dict[str(key)]
except KeyError:
non_matching_keys.append((key, value))
else:
keys_used.add(str(key))
result.append(gen_param_name_copy(key_param,
values=[value]))
key, value = next(var_arg_iterator, (None, None))
keys_only = True
assignments = param.get_assignment_calls().values
assignment = assignments[0]
@@ -657,8 +659,15 @@ class Execution(Executable):
# Just ignore all the params that are without a key, after one
# keyword argument was set.
if not keys_only or assignment[0] == '**':
keys_used.add(str(key))
result.append(gen_param_name_copy(param, keys=keys,
values=values, array_type=array_type))
if keys_only:
# sometimes param arguments are not completely written (which would
# create an Exception, but we have to handle that).
for k in set(param_dict) - keys_used:
result.append(gen_param_name_copy(param_dict[k]))
return result
def get_var_args_iterator(self):

View File

@@ -90,9 +90,6 @@ recursion2(1)
# ordering
# -----------------
#def b():
#return ""
def a():
#? int()
b()

View File

@@ -82,6 +82,13 @@ def func(a_param):
a_param.
from os import path
# should not return a function, because `a` is a function above
def f(b, a): return a
#? []
f(b=3)
# -----------------
# class
# -----------------