saltext.vault.utils.functools

Fixed namespaced_function from salt.utils.functools

saltext.vault.utils.functools.namespaced_function(function, global_dict, versionadded=None)[source]

Patched function taken from salt.utils.functools. It does not set kwdefaults and adapts mirrored docstrings.

Redefine (clone) a function under a different globals() namespace scope.

Any keys missing in the passed global_dict that is present in the passed function __globals__ attribute get’s copied over into global_dict, thus avoiding NameError from modules imported in the original function module.

When the destination is a runner or wrapper module, additionally adapts CLI examples in the function’s docstring to the corresponding calling convention.

versionadded

Override the function-level versionadded annotation in the function’s docstring (not parameter-level ones) with this version, e.g. because the function was made available in the destination module later than in the execution module.