# HG changeset patch # User Henry S. Thompson # Date 1773235488 0 # Node ID 279793350225fcab48be6692cfeca5437094b3fe # Parent 9ecf193718c11a22e7d300340f66ee814199ec2e decompOneBlock working with gzip diff -r 9ecf193718c1 -r 279793350225 lib/python/cc/warc.py --- a/lib/python/cc/warc.py Tue Mar 10 21:18:10 2026 +0000 +++ b/lib/python/cc/warc.py Wed Mar 11 13:24:48 2026 +0000 @@ -154,13 +154,15 @@ print('%d records, max record: %d, max header: %d'%(n, RECORDMAX, HDRMAX), file=sys.stderr) +import zlib, gzip, struct + def decompOneBlock(fp: io.BytesIO): """Decompress one block of a gzip compressed stream in one shot. Return the decompressed string and the stream repositioned at the start of the next block. """ data = fp.getbuffer() - if _read_gzip_header(fp) is None: + if gzip._read_gzip_header(fp) is None: return b"" # Use a zlib raw deflate compressor do = zlib.decompressobj(wbits=-zlib.MAX_WBITS)