mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-07 22:44:27 +08:00
param arguments that are being forgotten by the user are now added (no strange behaviour anymore)
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -90,9 +90,6 @@ recursion2(1)
|
||||
# ordering
|
||||
# -----------------
|
||||
|
||||
#def b():
|
||||
#return ""
|
||||
|
||||
def a():
|
||||
#? int()
|
||||
b()
|
||||
|
||||
@@ -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
|
||||
# -----------------
|
||||
|
||||
Reference in New Issue
Block a user