snf_experiments / method_v2 /evidence /code /packaging /create_source_manifest.py
CharlesZhang-USTC's picture
Add Control v2 incremental experiment results (evidence, visuals, 42 fixed samples)
a64600b verified
Raw History Blame Contribute Delete
611 Bytes
"""Hash vendored code without modifying upstream repositories."""
import hashlib
import json
from pathlib import Path
root=Path(__file__).resolve().parents[1]
manifest={}
for path in sorted((root/'vendor').rglob('*')):
if not path.is_file() or any(x in path.parts for x in ('.git','__pycache__','checkpoints','wandb')) or path.suffix.lower() in ('.mp4','.gif','.pyc'):continue
manifest[path.relative_to(root).as_posix()]=hashlib.sha256(path.read_bytes()).hexdigest()
(root/'packaging/sources.manifest.json').write_text(json.dumps(manifest,indent=2)+'\n')
print(f'Hashed {len(manifest)} vendored files')