jumpserver/apps/common/utils/inspect.py

11 lines
237 B
Python
Raw Normal View History

import inspect
def copy_function_args(func, locals_dict: dict):
signature = inspect.signature(func)
keys = signature.parameters.keys()
kwargs = {}
for k in keys:
kwargs[k] = locals_dict.get(k)
return kwargs