changeset 344:279793350225 trim

decompOneBlock working with gzip
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Wed, 11 Mar 2026 13:24:48 +0000
parents 9ecf193718c1
children 8c9e7578ed30
files lib/python/cc/warc.py
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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)