mirror of
https://github.com/lancedb/lancedb.git
synced 2025-12-22 21:09:58 +00:00
fix: add to_lance() and to_polars() stub methods for type-checkers (#2876)
Adds `Table.to_lance()` and `Table.to_polars()` methods (non-abstract methods, defaulting to `NotImplementedError`) so type checkers like mypy, pyright and ty don’t flag them as unknown attributes on `Table`. Not making these abstract methods should keep existing remote/other `Table` implementations instantiable. This is non-breaking change to existing functionality and is purely for the purpose of pleasing static type-checkers like mypy, ty and pyright. <img width="626" height="134" alt="image" src="https://github.com/user-attachments/assets/f4619bca-a882-432b-bd23-ae8f189ff9e3" />
This commit is contained in:
@@ -684,6 +684,24 @@ class Table(ABC):
|
|||||||
"""
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def to_lance(self, **kwargs) -> lance.LanceDataset:
|
||||||
|
"""Return the table as a lance.LanceDataset.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
lance.LanceDataset
|
||||||
|
"""
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
|
def to_polars(self, **kwargs) -> "pl.DataFrame":
|
||||||
|
"""Return the table as a polars.DataFrame.
|
||||||
|
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
polars.DataFrame
|
||||||
|
"""
|
||||||
|
raise NotImplementedError
|
||||||
|
|
||||||
def create_index(
|
def create_index(
|
||||||
self,
|
self,
|
||||||
metric="l2",
|
metric="l2",
|
||||||
|
|||||||
Reference in New Issue
Block a user