Source code for daops.data_utils.common_utils
"""Common utility functions for data operations."""
from pydoc import locate
[docs]
def handle_derive_str(value, ds_id, ds):
"""Handle the derive string."""
if isinstance(value, str) and "derive" in value:
components = value.split(":")
func = locate(components[1].strip())
if len(components) > 2:
arg = value.split(":")[-1].strip()
return func(ds_id, ds, arg)
else:
return func(ds_id, ds)
else:
return value