Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
json
Languages:
English
Size:
10K - 100K
ArXiv:
License:
| #!/usr/bin/env python3 | |
| """Write deterministic SHA-256 checksums for release files.""" | |
| from __future__ import annotations | |
| import hashlib | |
| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| EXCLUDED = {"checksums.sha256"} | |
| def digest(path: Path) -> str: | |
| hasher = hashlib.sha256() | |
| with path.open("rb") as handle: | |
| for block in iter(lambda: handle.read(1024 * 1024), b""): | |
| hasher.update(block) | |
| return hasher.hexdigest() | |
| def main() -> None: | |
| files = [ | |
| path for path in ROOT.rglob("*") | |
| if path.is_file() and path.name not in EXCLUDED and "__pycache__" not in path.parts | |
| ] | |
| lines = [f"{digest(path)} {path.relative_to(ROOT).as_posix()}" for path in sorted(files)] | |
| (ROOT / "checksums.sha256").write_text("\n".join(lines) + "\n", encoding="utf-8") | |
| print(f"Wrote checksums for {len(files)} files") | |
| if __name__ == "__main__": | |
| main() | |