Skip to content

Commit 6da56f1

Browse files
committed
ty fixes
1 parent 2be9090 commit 6da56f1

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

pyproject.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ warn_unused_ignores = true
4242
module = "structlog.*"
4343
ignore_missing_imports = true
4444

45+
[[tool.mypy.overrides]]
46+
# These files have type: ignore comments for ty that mypy doesn't need
47+
module = ["vgi.examples.scalar", "vgi.table_function"]
48+
warn_unused_ignores = false
49+
4550
[tool.ty.environment]
4651
python-version = "3.12"
4752

vgi/examples/scalar.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def output_type(self) -> pa.DataType:
5252

5353
def compute(self, batch: pa.RecordBatch) -> pa.Array[Any]:
5454
"""Double the values in the specified column."""
55-
return pc.multiply(batch.column(self.column), 2)
55+
return pc.multiply(batch.column(self.column), 2) # type: ignore[no-matching-overload]
5656

5757

5858
class AddColumnsFunction(ScalarFunction):
@@ -109,4 +109,4 @@ def output_type(self) -> pa.DataType:
109109

110110
def compute(self, batch: pa.RecordBatch) -> pa.Array[Any]:
111111
"""Convert the column values to uppercase."""
112-
return pc.utf8_upper(batch.column(self.column))
112+
return pc.utf8_upper(batch.column(self.column)) # type: ignore[no-matching-overload]

vgi/table_function.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
from collections.abc import Generator
2525
from dataclasses import dataclass
26-
from typing import Any, final
26+
from typing import Any, Self, final
2727

2828
import pyarrow as pa
2929
import structlog
@@ -331,14 +331,14 @@ def serialize(self) -> bytes:
331331
return vgi.ipc_utils.serialize_record_batch(batch)
332332

333333
@classmethod
334-
def deserialize(cls, batch: pa.RecordBatch) -> "TableFunctionInitInput":
334+
def deserialize(cls, batch: pa.RecordBatch) -> Self: # type: ignore[override]
335335
"""Deserialize TableFunctionInitInput from a RecordBatch."""
336336
values = batch.to_pylist()[0]
337337
# Handle backward compatibility: ignore extra fields
338338
return cls(projection_ids=values.get("projection_ids"))
339339

340340
@classmethod
341-
def deserialize_bytes(cls, data: bytes) -> "TableFunctionInitInput":
341+
def deserialize_bytes(cls, data: bytes) -> Self:
342342
"""Deserialize TableFunctionInitInput from bytes."""
343343
batch = vgi.ipc_utils.deserialize_record_batch(data)
344344
return cls.deserialize(batch)

0 commit comments

Comments
 (0)