Download tasks/vcc-correlation-structure/solution/verify_data.py from scalingX/cell-response-bench: direct link, hf CLI and curl.
- Browser
- Download file 961 Bytes
-
https://huggingface.co/datasets/scalingX/cell-response-bench/resolve/main/tasks/vcc-correlation-structure/solution/verify_data.py
- Command line
-
hf download hf://datasets/scalingX/cell-response-bench/tasks/vcc-correlation-structure/solution/verify_data.py
-
curl -L -o verify_data.py https://huggingface.co/datasets/scalingX/cell-response-bench/resolve/main/tasks/vcc-correlation-structure/solution/verify_data.py
961 Bytes
| # Standard-library SHA-256 integrity check for the provided real VCC files. | |
| import hashlib, os, sys | |
| def sha256_file(path): | |
| h = hashlib.sha256() | |
| with open(path, 'rb') as fh: | |
| for chunk in iter(lambda: fh.read(1 << 20), b''): | |
| h.update(chunk) | |
| return h.hexdigest() | |
| def main(): | |
| base = sys.argv[1] if len(sys.argv) > 1 else 'data' | |
| sums = os.path.join(base, 'SHA256SUMS') | |
| bad = 0 | |
| with open(sums) as fh: | |
| for line in fh: | |
| parts = line.split() | |
| if len(parts) != 2: | |
| continue | |
| want, name = parts | |
| got = sha256_file(os.path.join(base, name)) | |
| if got != want: | |
| print('CHECKSUM MISMATCH ' + name) | |
| bad += 1 | |
| else: | |
| print('OK ' + name + ' ' + got[:12]) | |
| if bad: | |
| print('DATA INTEGRITY FAILED') | |
| sys.exit(1) | |
| print('ALL CHECKSUMS OK') | |
| if __name__ == '__main__': | |
| main() | |