MCPcopy Create free account
hub / github.com/3DAnimals/3DAnimals / archive_code

Function archive_code

model/utils/misc.py:80–90  ·  view source on GitHub ↗
(arc_path, filetypes=['.py'])

Source from the content-addressed store, hash-verified

78
79
80def archive_code(arc_path, filetypes=['.py']):
81 print(f"Archiving code to {arc_path}")
82 xmkdir(os.path.dirname(arc_path))
83 zipf = zipfile.ZipFile(arc_path, 'w', zipfile.ZIP_DEFLATED)
84 cur_dir = os.getcwd()
85 flist = []
86 for ftype in filetypes:
87 flist.extend(glob.glob(os.path.join(cur_dir, '[!results]*', '**', '*'+ftype), recursive=True)) # ignore results folder
88 flist.extend(glob.glob(os.path.join(cur_dir, '*'+ftype)))
89 [zipf.write(f, arcname=f.replace(cur_dir,'archived_code', 1)) for f in flist]
90 zipf.close()
91
92
93def get_model_device(model):

Callers

nothing calls this directly

Calls 2

xmkdirFunction · 0.85
extendMethod · 0.80

Tested by

no test coverage detected