ProCreations's picture
Publish validated ICML reproduction
cbeeed4 verified
Raw
History Blame Contribute Delete
645 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 block in iter(lambda:f.read(1<<20),b''): h.update(block)
return h.hexdigest()
rows=[]
for path in sorted(ROOT.rglob('*')):
if path.is_file() and path!=OUT and '__pycache__' not in path.parts and 'replay-check' not in path.parts: rows.append(f"{digest(path)} {path.relative_to(ROOT).as_posix()}")
OUT.write_text('\n'.join(rows)+'\n',encoding='utf-8'); print(f"wrote {len(rows)} entries to {OUT.name}")