in cv.py [0:0]
def copy_assets(cfg, dir):
if isinstance(cfg, dict):
return {k: copy_assets(v, dir) for k, v in cfg.items()}
elif isinstance(cfg, list):
return [copy_assets(x, dir) for x in cfg]
elif isinstance(cfg, str) and os.path.exists(cfg):
new_pth = os.path.join(dir, "assets", os.path.basename(cfg))
shutil.copy(cfg, new_pth)
return new_pth
else:
return cfg