mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Switched getargspec return data from indexes to namedtuple notation
This commit is contained in:
parent
0ac5a8cd65
commit
c2af0a135d
@ -571,27 +571,27 @@ def format_call(fun, data):
|
||||
aspec = _getargs(fun)
|
||||
arglen = 0
|
||||
deflen = 0
|
||||
if isinstance(aspec[0], list):
|
||||
arglen = len(aspec[0])
|
||||
if isinstance(aspec[3], tuple):
|
||||
deflen = len(aspec[3])
|
||||
if aspec[2]:
|
||||
if isinstance(aspec.args, list):
|
||||
arglen = len(aspec.args)
|
||||
if isinstance(aspec.defaults, tuple):
|
||||
deflen = len(aspec.defaults)
|
||||
if aspec.keywords:
|
||||
# This state accepts kwargs
|
||||
ret['kwargs'] = {}
|
||||
for key in data:
|
||||
# Passing kwargs the conflict with args == stack trace
|
||||
if key in aspec[0]:
|
||||
if key in aspec.args:
|
||||
continue
|
||||
ret['kwargs'][key] = data[key]
|
||||
kwargs = {}
|
||||
for ind in range(arglen - 1, 0, -1):
|
||||
minus = arglen - ind
|
||||
if deflen - minus > -1:
|
||||
kwargs[aspec[0][ind]] = aspec[3][-minus]
|
||||
kwargs[aspec.args[ind]] = aspec.defaults[-minus]
|
||||
for arg in kwargs:
|
||||
if arg in data:
|
||||
kwargs[arg] = data[arg]
|
||||
for arg in aspec[0]:
|
||||
for arg in aspec.args:
|
||||
if arg in kwargs:
|
||||
ret['args'].append(kwargs[arg])
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user