Skip to content

Commit 443cebc

Browse files
rustyconoverclaude
andcommitted
fix(worker): make _unpack_bool_mask buffers cast robust across pyarrow-stub versions
The `# type: ignore[list-item]` on the from_buffers call is "unused" under some pyarrow-stub versions (CI) but required under others (local), so `mypy vgi/` failed on CI. Replace the ignore with a cast of the buffers list, which type-checks identically regardless of whether the stub signature admits a None validity buffer. Runtime behavior is unchanged (cast is a no-op). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 014a673 commit 443cebc

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

vgi/worker.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -775,7 +775,12 @@ def _unpack_bool_mask(data: bytes, length: int) -> pa.BooleanArray:
775775
if not data:
776776
return pa.array([True] * length, type=pa.bool_())
777777
buf = pa.py_buffer(data)
778-
return cast(pa.BooleanArray, pa.Array.from_buffers(pa.bool_(), length, [None, buf])) # type: ignore[list-item]
778+
# buffers = [validity bitmap (None → all valid), data buffer]. A None validity
779+
# buffer is valid at runtime, but pyarrow-stub versions disagree on whether the
780+
# signature admits it — some reject `None` (needing an ignore), others accept it
781+
# (making that ignore "unused"). A cast type-checks identically on both.
782+
buffers = cast("list[pa.Buffer]", [None, buf])
783+
return cast(pa.BooleanArray, pa.Array.from_buffers(pa.bool_(), length, buffers))
779784

780785

781786
def _unpack_frame_stats(data: bytes) -> tuple[tuple[int, int], tuple[int, int]]:

0 commit comments

Comments
 (0)