From 37386ed3eb213820c7840e4ed466e219462c1881 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 22 Dec 2025 17:43:38 +0000 Subject: [PATCH 1/2] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/rbubley/mirrors-prettier: v3.5.3 → v3.7.4](https://github.com/rbubley/mirrors-prettier/compare/v3.5.3...v3.7.4) - [github.com/pre-commit/mirrors-mypy: v1.15.0 → v1.19.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.15.0...v1.19.1) - [github.com/astral-sh/ruff-pre-commit: v0.11.11 → v0.14.10](https://github.com/astral-sh/ruff-pre-commit/compare/v0.11.11...v0.14.10) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1e54869b..5128f2f5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -9,18 +9,18 @@ ci: skip: [] repos: - repo: https://github.com/rbubley/mirrors-prettier - rev: v3.5.3 + rev: v3.7.4 hooks: - id: prettier exclude: ^.github/workflows/test.yaml - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.15.0 + rev: v1.19.1 hooks: - id: mypy additional_dependencies: [numpy, types-requests] exclude: tests/|docs/ - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.11 + rev: v0.14.10 hooks: - id: ruff args: [--fix, --exit-non-zero-on-fix] From 1f1c9e2cfe3973ab4d8e35bdabd15be5c3b1055e Mon Sep 17 00:00:00 2001 From: Luca Marconato Date: Sat, 3 Jan 2026 19:32:58 +0100 Subject: [PATCH 2/2] fix pre-commit --- src/spatialdata/_core/query/relational_query.py | 1 + src/spatialdata/_core/spatialdata.py | 4 ++-- src/spatialdata/_io/io_zarr.py | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/spatialdata/_core/query/relational_query.py b/src/spatialdata/_core/query/relational_query.py index 247bffeb..3f0fa935 100644 --- a/src/spatialdata/_core/query/relational_query.py +++ b/src/spatialdata/_core/query/relational_query.py @@ -968,6 +968,7 @@ def get_values( assert obs[region_key].nunique() == 1 assert obs[instance_key].nunique() == len(matched_table) else: + assert isinstance(element, AnnData) matched_table = element instance_key = matched_table.uns[TableModel.ATTRS_KEY][TableModel.INSTANCE_KEY] region_key = matched_table.uns[TableModel.ATTRS_KEY][TableModel.REGION_KEY_KEY] diff --git a/src/spatialdata/_core/spatialdata.py b/src/spatialdata/_core/spatialdata.py index 21bd6c5b..abc5e6ec 100644 --- a/src/spatialdata/_core/spatialdata.py +++ b/src/spatialdata/_core/spatialdata.py @@ -702,7 +702,7 @@ def _filter_tables( assert element_names is not None table = _filter_table_by_element_names(table, element_names) - if len(table) != 0: + if table is not None and len(table) != 0: tables[table_name] = table elif by == "elements": from spatialdata._core.query.relational_query import ( @@ -711,7 +711,7 @@ def _filter_tables( assert elements_dict is not None table = _filter_table_by_elements(table, elements_dict=elements_dict) - if len(table) != 0: + if table is not None and len(table) != 0: tables[table_name] = table else: tables = self.tables diff --git a/src/spatialdata/_io/io_zarr.py b/src/spatialdata/_io/io_zarr.py index 98919d61..0312dc96 100644 --- a/src/spatialdata/_io/io_zarr.py +++ b/src/spatialdata/_io/io_zarr.py @@ -158,7 +158,7 @@ def read_zarr( # the following is the SpatialDataContainerFormat version if "spatialdata_attrs" not in root_group.metadata.attributes: # backward compatibility for pre-versioned SpatialData zarr stores - sdata_version = cast(Literal["0.1", "0.2"], "0.1") + sdata_version: Literal["0.1", "0.2"] = "0.1" else: sdata_version = root_group.metadata.attributes["spatialdata_attrs"]["version"] if sdata_version == "0.1":