Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
workspaces: python
- name: Install linting tools
run: |
pip install ruff==0.4.1 maturin tensorflow tqdm ray[data] pyright datasets polars[pyarrow,pandas]
pip install ruff==0.11.2 maturin tensorflow tqdm ray[data] pyright datasets polars[pyarrow,pandas]
pip install torch --index-url https://download.pytorch.org/whl/cpu
- name: Lint Python
run: |
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.1
rev: v0.11.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand Down
3 changes: 1 addition & 2 deletions python/python/lance/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,7 @@ def set_logger(

def __warn_on_fork():
warnings.warn(
"lance is not fork-safe. If you are using multiprocessing, "
"use spawn instead."
"lance is not fork-safe. If you are using multiprocessing, use spawn instead."
)


Expand Down
14 changes: 7 additions & 7 deletions python/python/lance/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,43 +191,43 @@ def _might_be(cls: type, type_: str) -> bool:

def _check_for_numpy(obj: Any, *, check_type: bool = True) -> bool:
return _NUMPY_AVAILABLE and _might_be(
cast(Hashable, type(obj) if check_type else obj), "numpy"
cast("Hashable", type(obj) if check_type else obj), "numpy"
)


def _check_for_pandas(obj: Any, *, check_type: bool = True) -> bool:
return _PANDAS_AVAILABLE and _might_be(
cast(Hashable, type(obj) if check_type else obj), "pandas"
cast("Hashable", type(obj) if check_type else obj), "pandas"
)


def _check_for_polars(obj: Any, *, check_type: bool = True) -> bool:
return _POLARS_AVAILABLE and _might_be(
cast(Hashable, type(obj) if check_type else obj), "polars"
cast("Hashable", type(obj) if check_type else obj), "polars"
)


def _check_for_torch(obj: Any, *, check_type: bool = True) -> bool:
return _TORCH_AVAILABLE and _might_be(
cast(Hashable, type(obj) if check_type else obj), "torch"
cast("Hashable", type(obj) if check_type else obj), "torch"
)


def _check_for_hugging_face(obj: Any, *, check_type: bool = True) -> bool:
return _HUGGING_FACE_AVAILABLE and _might_be(
cast(Hashable, type(obj) if check_type else obj), "datasets"
cast("Hashable", type(obj) if check_type else obj), "datasets"
)


def _check_for_tensorflow(obj: Any, *, check_type: bool = True) -> bool:
return _TENSORFLOW_AVAILABLE and _might_be(
cast(Hashable, type(obj) if check_type else obj), "tensorflow"
cast("Hashable", type(obj) if check_type else obj), "tensorflow"
)


def _check_for_ray(obj: Any, *, check_type: bool = True) -> bool:
return _RAY_AVAILABLE and _might_be(
cast(Hashable, type(obj) if check_type else obj), "ray"
cast("Hashable", type(obj) if check_type else obj), "ray"
)


Expand Down
2 changes: 1 addition & 1 deletion python/python/lance/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def _normalize_metric_type(metric_type: str) -> MetricType:
normalized = "l2"
if normalized not in {"l2", "dot", "cosine"}:
raise ValueError(f"Invalid metric_type: {metric_type}")
return cast(MetricType, normalized)
return cast("MetricType", normalized)


def sanitize_ts(ts: ts_types) -> datetime:
Expand Down
4 changes: 1 addition & 3 deletions python/python/tests/test_scalar_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,7 @@ def test_fixed_size_binary(tmp_path):
ds.create_scalar_index("uuid", "BTREE")

query = (
"uuid = arrow_cast("
"0x32333435323334353233343532333435, "
"'FixedSizeBinary(16)')"
"uuid = arrow_cast(0x32333435323334353233343532333435, 'FixedSizeBinary(16)')"
)
assert "MaterializeIndex" in ds.scanner(filter=query).explain_plan()

Expand Down