changeset 242:e117424e244a

cleaned up indentation to 2 spaces throughout
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Wed, 02 Oct 2024 11:09:58 +0100
parents 96021cfee209
children 7bef91ca3d51
files lib/python/unpackz.py
diffstat 1 files changed, 36 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/lib/python/unpackz.py	Wed Oct 02 09:56:37 2024 +0100
+++ b/lib/python/unpackz.py	Wed Oct 02 11:09:58 2024 +0100
@@ -28,42 +28,42 @@
   z = isal.isal_zlib.decompressobj(31)
   count = 0
   while True:
-      if z.unused_data == b"": 
-          #print('n', obuf_len, file=sys.stderr)
-          if lastbuf:  # buf == b"":
-              if outfile is None:
-                print(obuf_len, offset)
-              else:
-                outfile.write(b'\000%d\000%d\000'%(obuf_len, offset))
-              if count!=0:
-                  print("Unused data: count=%s offset=%s ?"%(count, offset),
-                        file=sys.stderr)
-              break
-          if nbuf:
-              obuf_len += BUFSIZE # still no EOS after a full buffer processed
-          buf = f.read(BUFSIZE)
-          nbuf = True
-          lastbuf = ((truesize:=len(buf)) < BUFSIZE) # will only succeed if now at EOF
+    if z.unused_data == b"": 
+        #print('n', obuf_len, file=sys.stderr)
+      if lastbuf:  # buf == b"":
+        if outfile is None:
+          print(obuf_len, offset)
+        else:
+          outfile.write(b'\000%d\000%d\000'%(obuf_len, offset))
+        if count!=0:
+          print("Unused data: count=%s offset=%s ?"%(count, offset),
+                file=sys.stderr)
+        break
+      if nbuf:
+        obuf_len += BUFSIZE # still no EOS after a full buffer processed
+      buf = f.read(BUFSIZE)
+      nbuf = True
+      lastbuf = ((truesize:=len(buf)) < BUFSIZE) # will only succeed if now at EOF
+    else:
+      buf_len = len(buf)
+      #print('b', obuf_len, buf_len, len(z.unused_data), len(buf)-len(z.unused_data),
+      #      nbuf, lastbuf, file=sys.stderr)
+      count = (obuf_len if (buf_len == truesize) else 0) + \
+              (len(buf)-len(z.unused_data))
+      if outfile is None:
+        print(count, offset)
       else:
-          buf_len = len(buf)
-          #print('b', obuf_len, buf_len, len(z.unused_data), len(buf)-len(z.unused_data),
-          #      nbuf, lastbuf, file=sys.stderr)
-          count = (obuf_len if (buf_len == truesize) else 0) + \
-                  (len(buf)-len(z.unused_data))
-          if outfile is None:
-            print(count, offset)
-          else:
-            outfile.write(b'\000%d\000%d\000'%(count, offset))
-#          if (offset == 1352249):
-#            breakpoint()
-          offset += count
-          count = 0
-          buf = z.unused_data
-          obuf_len = len(buf)
-          nbuf = False
-          z = isal.isal_zlib.decompressobj(31)
-      got = z.decompress(buf)
-      if outfile is not None:
-        outfile.write(got)
+        outfile.write(b'\000%d\000%d\000'%(count, offset))
+      #if (offset == 1352249):
+      #  breakpoint()
+      offset += count
+      count = 0
+      buf = z.unused_data
+      obuf_len = len(buf)
+      nbuf = False
+      z = isal.isal_zlib.decompressobj(31)
+    got = z.decompress(buf)
+    if outfile is not None:
+      outfile.write(got)
 if outfile is not None:
   outfile.close()