From ed26ad94bc179ddd233ae93fa35ddbea8a852240 Mon Sep 17 00:00:00 2001 From: Chris Markiewicz Date: Sat, 7 Sep 2024 12:16:47 -0400 Subject: [PATCH] typ: Ignore Pointset.__rmatmul__/ndarray.__matmul__ inconsistency --- nibabel/pointset.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nibabel/pointset.py b/nibabel/pointset.py index 70a802480..889a8c70c 100644 --- a/nibabel/pointset.py +++ b/nibabel/pointset.py @@ -101,7 +101,11 @@ def dim(self) -> int: """The dimensionality of the space the coordinates are in""" return self.coordinates.shape[1] - self.homogeneous - def __rmatmul__(self, affine: np.ndarray) -> Self: + # Use __rmatmul__ to prefer to compose affines. Mypy does not like that + # this conflicts with ndarray.__matmul__. We will need some more feedback + # on how this plays out for type-checking or code suggestions before we + # can do better than ignore. + def __rmatmul__(self, affine: np.ndarray) -> Self: # type: ignore[misc] """Apply an affine transformation to the pointset This will return a new pointset with an updated affine matrix only.