cr-proc 0.1.3__tar.gz → 0.1.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cr_proc
3
- Version: 0.1.3
4
- Summary: A tool for processing BYU CS code recording files
3
+ Version: 0.1.6
4
+ Summary: A tool for processing BYU CS code recording files.
5
5
  Author: Ethan Dye
6
6
  Author-email: mrtops03@gmail.com
7
7
  Requires-Python: >=3.14
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "cr_proc"
3
- version = "0.1.3"
4
- description = "A tool for processing BYU CS code recording files"
3
+ version = "0.1.6"
4
+ description = "A tool for processing BYU CS code recording files."
5
5
  authors = [
6
6
  {name = "Ethan Dye",email = "mrtops03@gmail.com"}
7
7
  ]
@@ -65,12 +65,29 @@ def load_jsonl(file: Path) -> tuple[dict[str, Any], ...]:
65
65
 
66
66
  if data is None:
67
67
  # If gzip stream is broken, attempt a lenient zlib decompress to salvage content.
68
+ # Handle multiple concatenated gzip streams (common in recordings)
68
69
  try:
69
70
  raw = file.read_bytes()
70
- dobj = zlib.decompressobj(16 + zlib.MAX_WBITS)
71
- text_bytes = dobj.decompress(raw) + dobj.flush()
72
- text = text_bytes.decode("utf-8", errors="replace")
73
- data = _load_jsonl(StringIO(text))
71
+ all_text = ""
72
+ remaining = raw
73
+
74
+ # Decompress all concatenated gzip streams
75
+ while remaining:
76
+ dobj = zlib.decompressobj(16 + zlib.MAX_WBITS)
77
+ try:
78
+ text_bytes = dobj.decompress(remaining) + dobj.flush()
79
+ all_text += text_bytes.decode("utf-8", errors="replace")
80
+ remaining = dobj.unused_data
81
+ if not text_bytes or not remaining:
82
+ break
83
+ except Exception:
84
+ # If decompression fails, try to salvage what we have
85
+ break
86
+
87
+ if all_text:
88
+ data = _load_jsonl(StringIO(all_text))
89
+ else:
90
+ data = None
74
91
  except Exception:
75
92
  data = None
76
93