ProCreations's picture
Publish validated ICML reproduction
c383eec verified
Raw
History Blame Contribute Delete
582 Bytes
#!/usr/bin/env python3
from __future__ import annotations
import hashlib
from pathlib import Path
ROOT=Path(__file__).resolve().parent; OUT=ROOT/"BUNDLE_SHA256SUMS.txt"
def digest(path):
h=hashlib.sha256()
with path.open("rb") as f:
for b in iter(lambda:f.read(1<<20),b""): h.update(b)
return h.hexdigest()
rows=[]
for p in sorted(ROOT.rglob("*")):
if p.is_file() and p!=OUT and "__pycache__" not in p.parts: rows.append(f"{digest(p)} {p.relative_to(ROOT).as_posix()}")
OUT.write_text("\n".join(rows)+"\n",encoding="utf-8"); print(f"wrote {len(rows)} entries to {OUT.name}")