"""Verify a mirror against (possibly partial) chunks of the official ZIP release. Scans the official split-zip chunks for local file headers (PK\\x03\\x04), reads each entry's name, CRC-32 and uncompressed size, and compares them with the same relative paths in the mirror directory. python scripts/verify_zip_mirror.py --chunks data/dl/ddr/DDR-dataset.zip.00[1-5] --mirror data/dl/ddr_hf \ --strip-prefix DDR-dataset/ --only-prefix DR_grading/ --out data/bench/ddr_mirror_verification.csv """ import argparse import struct import zlib from pathlib import Path import pandas as pd SIG = b"PK\x03\x04" def local_headers(chunks): """Yield (name, crc32, uncompressed_size) for every local header found in the concatenated chunks.""" data = b"".join(Path(c).read_bytes() for c in chunks) pos = data.find(SIG) while pos != -1 and pos + 30 <= len(data): flags, method, _, _, crc, csize, usize, nlen, xlen = struct.unpack("