mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
format_call_defaults
is not necessary since it the same as arg_lookup
.
Fixed arguments popping order.
This commit is contained in:
parent
94ddf88eb6
commit
0665d9708f
@ -679,32 +679,6 @@ def build_whitepace_splited_regex(text):
|
||||
build_whitespace_split_regex(text)
|
||||
|
||||
|
||||
def format_call_defaults(function):
|
||||
'''
|
||||
Build the default function call signature. Arguments will be the argument
|
||||
names, keyword arguments will have it's default values set.
|
||||
'''
|
||||
args = []
|
||||
kwargs = {}
|
||||
|
||||
aspec = get_function_argspec(function)
|
||||
|
||||
try:
|
||||
func_defaults = aspec.defaults[::-1]
|
||||
except TypeError:
|
||||
# There are no function defaults
|
||||
func_defaults = []
|
||||
|
||||
for idx, arg in enumerate(aspec.args[::-1]):
|
||||
try:
|
||||
kwargs[arg] = func_defaults[idx]
|
||||
except IndexError:
|
||||
args.append(arg)
|
||||
|
||||
args.reverse()
|
||||
return args, kwargs
|
||||
|
||||
|
||||
def format_call(fun,
|
||||
data,
|
||||
initial_ret=None,
|
||||
@ -730,7 +704,7 @@ def format_call(fun,
|
||||
|
||||
aspec = get_function_argspec(fun)
|
||||
|
||||
args, kwargs = format_call_defaults(fun)
|
||||
args, kwargs = arg_lookup(fun).values()
|
||||
|
||||
# Since we WILL be changing the data dictionary, let's change a copy of it
|
||||
data = data.copy()
|
||||
|
Loading…
Reference in New Issue
Block a user