MCPcopy Create free account
hub / github.com/cxmomo/RaCFormer / backup_code

Function backup_code

utils.py:28–39  ·  view source on GitHub ↗
(work_dir, verbose=False)

Source from the content-addressed store, hash-verified

26
27
28def backup_code(work_dir, verbose=False):
29 base_dir = os.path.dirname(os.path.abspath(__file__))
30 for pattern in ['*.py', 'configs/*.py', 'models/*.py', 'loaders/*.py', 'loaders/pipelines/*.py']:
31 for file in glob.glob(pattern):
32 src = os.path.join(base_dir, file)
33 dst = os.path.join(work_dir, 'backup', os.path.dirname(file))
34
35 if verbose:
36 logging.info('Copying %s -> %s' % (os.path.relpath(src), os.path.relpath(dst)))
37
38 os.makedirs(dst, exist_ok=True)
39 shutil.copy2(src, dst)
40
41
42@HOOKS.register_module()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected