Skip to content

Commit

Permalink
CRTFParser is deprecated
Browse files Browse the repository at this point in the history
  • Loading branch information
keflavich committed Sep 29, 2023
1 parent 4793c27 commit 903b433
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spectral_cube/spectral_cube.py
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,10 @@ def subcube_from_crtfregion(self, crtf_region, allow_empty=False):
import regions

if isinstance(crtf_region, six.string_types):
region_list = regions.CRTFParser(crtf_region).shapes.to_regions()
if hasattr(regions, 'CRTFParser'):
region_list = regions.CRTFParser(crtf_region).shapes.to_regions()

Check warning on line 2051 in spectral_cube/spectral_cube.py

View check run for this annotation

Codecov / codecov/patch

spectral_cube/spectral_cube.py#L2050-L2051

Added lines #L2050 - L2051 were not covered by tests
else:
region_list = regions.Regions.read(crtf_region)

Check warning on line 2053 in spectral_cube/spectral_cube.py

View check run for this annotation

Codecov / codecov/patch

spectral_cube/spectral_cube.py#L2053

Added line #L2053 was not covered by tests
else:
raise TypeError("{0} should be a CRTF string".format(crtf_region))

Expand Down

0 comments on commit 903b433

Please sign in to comment.