Datasets:
Download source/legacy_project/code/package_release.py from Ethosoft/RefSeg-CA: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/datasets/Ethosoft/RefSeg-CA/resolve/main/source/legacy_project/code/package_release.py
- Command line
-
hf download hf://datasets/Ethosoft/RefSeg-CA/source/legacy_project/code/package_release.py
-
curl -L -o package_release.py https://huggingface.co/datasets/Ethosoft/RefSeg-CA/resolve/main/source/legacy_project/code/package_release.py
1.44 kB
| """Create the compact reproducibility archive without transient TeX/cache files.""" | |
| from pathlib import Path | |
| import hashlib,json,zipfile | |
| R=Path(__file__).resolve().parents[1] | |
| def included(p): | |
| rel=p.relative_to(R) | |
| if not p.is_file() or any(x.startswith('.') or x=='__pycache__' for x in rel.parts):return False | |
| if rel.parts[0] in ['build','cache','vendor','assets']:return False | |
| if rel.parts[0] in ['figures','latex'] and p.suffix in ['.aux','.log','.out','.toc','.blg','.fls','.fdb_latexmk']:return False | |
| if rel.parts[0]=='latex' and p.name.startswith('sn-') and p.suffix=='.bst' and p.name!='sn-mathphys-num.bst':return False | |
| return p.suffix not in ['.pyc','.fmt','.part'] | |
| def main(): | |
| files=sorted(p for p in R.rglob('*') if included(p) and p.name!='checksums.json') | |
| sums={str(p.relative_to(R)):hashlib.sha256(p.read_bytes()).hexdigest() for p in files} | |
| check=R/'protocol/checksums.json';check.write_text(json.dumps(sums,indent=2));files.append(check) | |
| out=R.parent/'RefSeg_CACP_MVA_Complete_Package.zip' | |
| with zipfile.ZipFile(out,'w',zipfile.ZIP_DEFLATED,compresslevel=9) as z: | |
| for p in files:z.write(p,str(Path(R.name)/p.relative_to(R))) | |
| with zipfile.ZipFile(out) as z:assert z.testzip() is None | |
| print(json.dumps({'archive':str(out),'files':len(files),'bytes':out.stat().st_size,'sha256':hashlib.sha256(out.read_bytes()).hexdigest()},indent=2)) | |
| if __name__=='__main__':main() | |