Skip to content

Commit 7641a69

Browse files
author
Sonja Stockhaus
committed
fix mypy error 2
1 parent 67a7761 commit 7641a69

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/spatialdata_plot/pl/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2363,15 +2363,15 @@ def _prepare_transformation(
23632363

23642364
def _get_datashader_trans_matrix_of_single_element(
23652365
trans: Identity | Scale | Affine | MapAxis | Translation,
2366-
) -> npt.NDArray[Any]:
2366+
) -> ArrayLike:
23672367
flip_matrix = np.array([[1, 0, 0], [0, -1, 0], [0, 0, 1]])
2368-
tm: npt.NDArray[Any] = trans.to_affine_matrix(("x", "y"), ("x", "y"))
2368+
tm: ArrayLike = trans.to_affine_matrix(("x", "y"), ("x", "y"))
23692369

23702370
if isinstance(trans, Identity):
23712371
return np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
23722372
if isinstance(trans, (Scale | Affine)):
23732373
# idea: "flip the y-axis", apply transformation, flip back
2374-
flip_and_transform: npt.NDArray[Any] = flip_matrix @ tm @ flip_matrix
2374+
flip_and_transform: ArrayLike = flip_matrix @ tm @ flip_matrix
23752375
return flip_and_transform
23762376
if isinstance(trans, MapAxis):
23772377
# no flipping needed
@@ -2382,7 +2382,7 @@ def _get_datashader_trans_matrix_of_single_element(
23822382

23832383
def _get_transformation_matrix_for_datashader(
23842384
trans: Scale | Identity | Affine | MapAxis | Translation | SDSequence,
2385-
) -> npt.NDArray[Any]:
2385+
) -> ArrayLike:
23862386
"""Get the affine matrix needed to transform shapes for rendering with datashader."""
23872387
if isinstance(trans, SDSequence):
23882388
tm = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]])
@@ -2545,7 +2545,7 @@ def _multipolygon_to_circle(multipolygon: shapely.MultiPolygon) -> tuple[shapely
25452545
points = np.array(coords)
25462546
circle_points = points[ConvexHull(points).vertices]
25472547
center = np.mean(circle_points, axis=0)
2548-
radius = max(np.linalg.norm(p - center) for p in circle_points)
2548+
radius = max(float(np.linalg.norm(p - center)) for p in circle_points)
25492549
assert isinstance(radius, float) # shut up mypy
25502550
return shapely.Point(center), radius
25512551

0 commit comments

Comments
 (0)