Skip to content

Commit fa17d9e

Browse files
rustyconoverclaude
andcommitted
fix(worker): type from_buffers buffers as Any to satisfy both pyarrow-stub versions
The prior cast to list[Buffer] passed local mypy but failed CI, whose pyarrow stubs type the parameter as list[Buffer | None]. list is invariant, so no single concrete annotation satisfies both signatures. Type the buffers list as Any, which is assignable to either. Verified mypy vgi/ + ruff clean locally. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 443cebc commit fa17d9e

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

‎vgi/worker.py‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -776,10 +776,11 @@ def _unpack_bool_mask(data: bytes, length: int) -> pa.BooleanArray:
776776
return pa.array([True] * length, type=pa.bool_())
777777
buf = pa.py_buffer(data)
778778
# 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])
779+
# buffer is valid at runtime, but pyarrow-stub versions disagree on the param
780+
# type (`list[Buffer]` vs `list[Buffer | None]`), and list invariance means no
781+
# single concrete annotation satisfies both. Type as Any so the call checks on
782+
# either version without a version-fragile `# type: ignore`.
783+
buffers: Any = [None, buf]
783784
return cast(pa.BooleanArray, pa.Array.from_buffers(pa.bool_(), length, buffers))
784785

785786

0 commit comments

Comments
 (0)