forked from VimPlug/jedi
fix for the newly created keyword/default tests
This commit is contained in:
+9
-11
@@ -49,6 +49,7 @@ def get_params(evaluator, func, var_args):
|
|||||||
keys = []
|
keys = []
|
||||||
values = []
|
values = []
|
||||||
array_type = None
|
array_type = None
|
||||||
|
has_default_value = False
|
||||||
if param.stars == 1:
|
if param.stars == 1:
|
||||||
# *args param
|
# *args param
|
||||||
array_type = pr.Array.TUPLE
|
array_type = pr.Array.TUPLE
|
||||||
@@ -66,13 +67,12 @@ def get_params(evaluator, func, var_args):
|
|||||||
if non_matching_keys:
|
if non_matching_keys:
|
||||||
keys, values = zip(*non_matching_keys)
|
keys, values = zip(*non_matching_keys)
|
||||||
non_matching_keys = []
|
non_matching_keys = []
|
||||||
elif not keys_only:
|
else:
|
||||||
# normal param
|
# normal param
|
||||||
if value is not None:
|
if value is None:
|
||||||
values = [value]
|
|
||||||
else:
|
|
||||||
if param.assignment_details:
|
if param.assignment_details:
|
||||||
# No value: return the default values.
|
# No value: return the default values.
|
||||||
|
has_default_value = True
|
||||||
result.append(param.get_name())
|
result.append(param.get_name())
|
||||||
param.is_generated = True
|
param.is_generated = True
|
||||||
else:
|
else:
|
||||||
@@ -88,10 +88,11 @@ def get_params(evaluator, func, var_args):
|
|||||||
m = _error_argument_count(func, len(var_args))
|
m = _error_argument_count(func, len(var_args))
|
||||||
analysis.add(evaluator, 'type-error-too-few-arguments',
|
analysis.add(evaluator, 'type-error-too-few-arguments',
|
||||||
var_args, message=m)
|
var_args, message=m)
|
||||||
|
else:
|
||||||
|
values = [value]
|
||||||
|
|
||||||
# Just ignore all the params that are without a key, after one keyword
|
# Now add to result if it's not one of the previously covered cases.
|
||||||
# argument was set.
|
if not has_default_value and (not keys_only or param.stars == 2):
|
||||||
if (not keys_only or param.stars == 2):
|
|
||||||
keys_used.add(str(key))
|
keys_used.add(str(key))
|
||||||
result.append(_gen_param_name_copy(func, var_args, param,
|
result.append(_gen_param_name_copy(func, var_args, param,
|
||||||
keys=keys, values=values,
|
keys=keys, values=values,
|
||||||
@@ -100,10 +101,7 @@ def get_params(evaluator, func, var_args):
|
|||||||
if keys_only:
|
if keys_only:
|
||||||
# All arguments should be handed over to the next function. It's not
|
# All arguments should be handed over to the next function. It's not
|
||||||
# about the values inside, it's about the names. Jedi needs to now that
|
# about the values inside, it's about the names. Jedi needs to now that
|
||||||
# there's nothing to find for certain names. In this case,
|
# there's nothing to find for certain names.
|
||||||
# just
|
|
||||||
# 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:
|
for k in set(param_dict) - keys_used:
|
||||||
result.append(_gen_param_name_copy(func, var_args, param_dict[k]))
|
result.append(_gen_param_name_copy(func, var_args, param_dict[k]))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user