mirror of
https://github.com/beak-insights/felicity-lims.git
synced 2025-02-24 17:02:55 +08:00
34 lines
846 B
Python
34 lines
846 B
Python
def get_passed_args(inspection):
|
|
"""
|
|
Retrieve user passed function arguments from the current frame from inspect
|
|
|
|
:param inspection: current frame arguments
|
|
:return: dict of arguments passed into function
|
|
"""
|
|
_args = inspection.args
|
|
_locals = inspection.locals
|
|
|
|
kwargs = {}
|
|
if 'kwargs' in _locals.keys():
|
|
kwargs = _locals.get('kwargs')
|
|
del _locals['kwargs']
|
|
|
|
if 'self' in _args:
|
|
del _locals['self']
|
|
|
|
if 'info' in _args:
|
|
del _locals['info']
|
|
|
|
final = {**kwargs, **_locals}
|
|
# [(arg,args.locals[arg]) for arg in args.args]
|
|
# print(f"Func Inspector: {final}")
|
|
return final
|
|
|
|
|
|
def has_value_or_is_truthy(val) -> bool: # noqa
|
|
if not val:
|
|
return False
|
|
if isinstance(val, str):
|
|
if not val.strip():
|
|
return False
|
|
return True
|