Skip to content

Commit

Permalink
ENH: Make type hinting compatible with Python 3.9
Browse files Browse the repository at this point in the history
Make type hinting compatible with Python 3.9: use `Union` instead of the
pipe operator `|` to support type hints in Python 3.9. The pipe operator
was overloaded for writing union types starting Python 3.10:
https://peps.python.org/pep-0604/
https://docs.python.org/3.9/library/typing.html
https://docs.python.org/3.10/library/typing.html
  • Loading branch information
jhlegarreta committed Dec 27, 2024
1 parent e89ab63 commit c022f91
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion nireports/tools/ndimage.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
Mat = npt.NDArray[np.float64]


def rotation2canonical(img: SpatialImage) -> Mat | None:
def rotation2canonical(img: SpatialImage) -> ty.Union[Mat | None]:
"""Calculate the rotation w.r.t. cardinal axes of input image."""
img = nb.as_closest_canonical(img)
# XXX: SpatialImage.affine needs to be typed
Expand Down

0 comments on commit c022f91

Please sign in to comment.