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_dictthat is present in the passed function__globals__attribute get’s copied over intoglobal_dict, thus avoidingNameErrorfrom 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
versionaddedannotation 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.