Skip to content

Commit

Permalink
tools.image: fixed compat issue with Py<3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRaybaut committed Oct 8, 2023
1 parent c1b6fbf commit 5ff3df2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions plotpy/tools/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@
if TYPE_CHECKING: # pragma: no cover
from plotpy.plot import BasePlot

MaskedItem = Union[MaskedImageItem, MaskedXYImageItem]


class ImageStatsRectangle(AnnotatedRectangle):
""" """
Expand Down Expand Up @@ -598,11 +596,12 @@ def find_masked_image(self, plot):
:param plot:
:return:
"""
maskedtypes = (MaskedImageItem, MaskedXYImageItem)
item = plot.get_active_item()
if isinstance(item, MaskedItem):
if isinstance(item, maskedtypes):
return item
else:
items = [item for item in plot.get_items() if isinstance(item, MaskedItem)]
items = [item for item in plot.get_items() if isinstance(item, maskedtypes)]
if items:
return items[-1]

Expand Down

0 comments on commit 5ff3df2

Please sign in to comment.