diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 0e827021174..39475191bf7 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -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: | diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e31ba3b6d68..09c956152fe 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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] diff --git a/python/python/lance/__init__.py b/python/python/lance/__init__.py index 54339c1291a..8c2694c878a 100644 --- a/python/python/lance/__init__.py +++ b/python/python/lance/__init__.py @@ -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." ) diff --git a/python/python/lance/dependencies.py b/python/python/lance/dependencies.py index f3e1a620378..19855a990d0 100644 --- a/python/python/lance/dependencies.py +++ b/python/python/lance/dependencies.py @@ -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" ) diff --git a/python/python/lance/util.py b/python/python/lance/util.py index b6e25f851f5..62da80fa202 100644 --- a/python/python/lance/util.py +++ b/python/python/lance/util.py @@ -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: diff --git a/python/python/tests/test_scalar_index.py b/python/python/tests/test_scalar_index.py index fa1b331e421..f3030c44f8f 100644 --- a/python/python/tests/test_scalar_index.py +++ b/python/python/tests/test_scalar_index.py @@ -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()