Datasets:
Tasks:
Image Segmentation
Modalities:
Image
Formats:
imagefolder
Languages:
English
Size:
1K - 10K
License:
| #!/usr/bin/env python3 | |
| """Write the deterministic SHA-256 manifest for a release directory.""" | |
| from __future__ import annotations | |
| import argparse | |
| import hashlib | |
| from pathlib import Path | |
| def sha256_file(path: Path) -> str: | |
| digest = hashlib.sha256() | |
| with path.open("rb") as handle: | |
| for block in iter(lambda: handle.read(1024 * 1024), b""): | |
| digest.update(block) | |
| return digest.hexdigest() | |
| def main() -> int: | |
| parser = argparse.ArgumentParser(description=__doc__) | |
| parser.add_argument("--root", type=Path, default=Path(".")) | |
| args = parser.parse_args() | |
| root = args.root.resolve() | |
| output = root / "SHA256SUMS.txt" | |
| files = sorted( | |
| path | |
| for path in root.rglob("*") | |
| if path.is_file() | |
| and path != output | |
| and ".git" not in path.relative_to(root).parts | |
| and "__pycache__" not in path.relative_to(root).parts | |
| ) | |
| rows = [f"{sha256_file(path)} {path.relative_to(root).as_posix()}\n" for path in files] | |
| output.write_text("".join(rows), encoding="utf-8") | |
| print(f"wrote {len(rows)} entries to {output}") | |
| return 0 | |
| if __name__ == "__main__": | |
| raise SystemExit(main()) | |