From 5b95fc12096c001d518a41965f5409a256be9902 Mon Sep 17 00:00:00 2001 From: ArneDefauw Date: Tue, 17 Dec 2024 13:49:25 +0100 Subject: [PATCH] fix mypy --- src/spatialdata/_core/operations/rasterize_bins.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/spatialdata/_core/operations/rasterize_bins.py b/src/spatialdata/_core/operations/rasterize_bins.py index f2a034fb..fd0cdea7 100644 --- a/src/spatialdata/_core/operations/rasterize_bins.py +++ b/src/spatialdata/_core/operations/rasterize_bins.py @@ -115,6 +115,9 @@ def rasterize_bins( if isinstance(element, DataArray): transformations = get_transformation(element, get_all=True) + # satisfy mypy + if not isinstance(transformations, dict): + raise TypeError("Expected transformations to be a dictionary when get_all=True.") else: # get the transformation if table.n_obs < 6: @@ -228,7 +231,12 @@ def channel_rasterization(block_id: tuple[int, int, int] | None) -> ArrayLike: else: image[i, y, x] = table.X[:, key_index] - return Image2DModel.parse(image, transformations=transformations, c_coords=keys, dims=("c", "y", "x")) + return Image2DModel.parse( + data=image, + dims=("c", "y", "x"), + transformations=transformations, + c_coords=keys, + ) def _get_uint_dtype(value: int) -> str: