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()
|
var_arg_iterator = self.get_var_args_iterator()
|
||||||
|
|
||||||
non_matching_keys = []
|
non_matching_keys = []
|
||||||
|
keys_used = set()
|
||||||
keys_only = False
|
keys_only = False
|
||||||
for param in self.base.params[start_offset:]:
|
for param in self.base.params[start_offset:]:
|
||||||
# The value and key can both be null. There, the defaults apply.
|
# The value and key can both be null. There, the defaults apply.
|
||||||
@@ -609,15 +610,16 @@ class Execution(Executable):
|
|||||||
# completions.
|
# completions.
|
||||||
key, value = next(var_arg_iterator, (None, None))
|
key, value = next(var_arg_iterator, (None, None))
|
||||||
while key:
|
while key:
|
||||||
|
keys_only = True
|
||||||
try:
|
try:
|
||||||
key_param = param_dict[str(key)]
|
key_param = param_dict[str(key)]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
non_matching_keys.append((key, value))
|
non_matching_keys.append((key, value))
|
||||||
else:
|
else:
|
||||||
|
keys_used.add(str(key))
|
||||||
result.append(gen_param_name_copy(key_param,
|
result.append(gen_param_name_copy(key_param,
|
||||||
values=[value]))
|
values=[value]))
|
||||||
key, value = next(var_arg_iterator, (None, None))
|
key, value = next(var_arg_iterator, (None, None))
|
||||||
keys_only = True
|
|
||||||
|
|
||||||
assignments = param.get_assignment_calls().values
|
assignments = param.get_assignment_calls().values
|
||||||
assignment = assignments[0]
|
assignment = assignments[0]
|
||||||
@@ -657,8 +659,15 @@ class Execution(Executable):
|
|||||||
# Just ignore all the params that are without a key, after one
|
# Just ignore all the params that are without a key, after one
|
||||||
# keyword argument was set.
|
# keyword argument was set.
|
||||||
if not keys_only or assignment[0] == '**':
|
if not keys_only or assignment[0] == '**':
|
||||||
|
keys_used.add(str(key))
|
||||||
result.append(gen_param_name_copy(param, keys=keys,
|
result.append(gen_param_name_copy(param, keys=keys,
|
||||||
values=values, array_type=array_type))
|
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
|
return result
|
||||||
|
|
||||||
def get_var_args_iterator(self):
|
def get_var_args_iterator(self):
|
||||||
|
|||||||
@@ -90,9 +90,6 @@ recursion2(1)
|
|||||||
# ordering
|
# ordering
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|
||||||
#def b():
|
|
||||||
#return ""
|
|
||||||
|
|
||||||
def a():
|
def a():
|
||||||
#? int()
|
#? int()
|
||||||
b()
|
b()
|
||||||
|
|||||||
@@ -82,6 +82,13 @@ def func(a_param):
|
|||||||
a_param.
|
a_param.
|
||||||
|
|
||||||
from os import path
|
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
|
# class
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|||||||
Reference in New Issue
Block a user