Skip to content

Commit 08b7c3f

Browse files
committed
MNT: Drop DataobjImage.get_shape, deprecated in 1.2, expired in 3.0
1 parent 2ba013a commit 08b7c3f

File tree

5 files changed

+1
-26
lines changed

5 files changed

+1
-26
lines changed

nibabel/dataobj_images.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -404,15 +404,6 @@ def shape(self):
404404
def ndim(self):
405405
return self._dataobj.ndim
406406

407-
@deprecate_with_version('get_shape method is deprecated.\n'
408-
'Please use the ``img.shape`` property '
409-
'instead.',
410-
'1.2', '3.0')
411-
def get_shape(self):
412-
""" Return shape for image
413-
"""
414-
return self.shape
415-
416407
@classmethod
417408
def from_file_map(klass, file_map, *, mmap=True, keep_file_open=None):
418409
""" Class method to create image from mapping in ``file_map``

nibabel/spatialimages.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
``fname``, where the derivation may differ between formats.
2929
* to_file_map() - save image to files with which the image is already
3030
associated.
31-
* .get_shape() (deprecated)
3231
3332
properties:
3433

nibabel/tests/test_image_api.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
from nibabel.testing import (bytesio_round_trip, bytesio_filemap, assert_data_similar,
4949
clear_and_catch_warnings, nullcontext)
5050
from ..tmpdirs import InTemporaryDirectory
51-
from ..deprecator import ExpiredDeprecationError
5251

5352
from .test_api_validators import ValidateAPI
5453
from .test_minc1 import EXAMPLE_IMAGES as MINC1_EXAMPLE_IMAGES
@@ -450,12 +449,6 @@ def validate_ndim(self, imaker, params):
450449
with pytest.raises(AttributeError):
451450
img.ndim = 5
452451

453-
def validate_shape_deprecated(self, imaker, params):
454-
# Check deprecated get_shape API
455-
img = imaker()
456-
with pytest.raises(ExpiredDeprecationError):
457-
img.get_shape()
458-
459452
def validate_mmap_parameter(self, imaker, params):
460453
img = imaker()
461454
fname = img.get_filename()

nibabel/tests/test_removalschedule.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
ATTRIBUTE_SCHEDULE = [
2323
("5.0.0", [("nibabel.dataobj_images", "DataobjImage", "get_data")]),
24+
("4.0.0", [("nibabel.dataobj_images", "DataobjImage", "get_shape")]),
2425
# Verify that the test will be quiet if the schedule outlives the modules
2526
("1.0.0", [("nibabel.nosuchmod", "anyobj", "anyattr"),
2627
("nibabel.nifti1", "nosuchobj", "anyattr"),

nibabel/tests/test_spatialimages.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -301,15 +301,6 @@ def test_str(self):
301301
img = img_klass(np.zeros((2, 3, 4), dtype=np.int16), np.eye(4))
302302
assert len(str(img)) > 0
303303

304-
def test_get_shape(self):
305-
# Check that get_shape raises an ExpiredDeprecationError
306-
img_klass = self.image_class
307-
# Assumes all possible images support int16
308-
# See https://github.com/nipy/nibabel/issues/58
309-
img = img_klass(np.arange(1, dtype=np.int16), np.eye(4))
310-
with pytest.raises(ExpiredDeprecationError):
311-
img.get_shape()
312-
313304
def test_get_fdata(self):
314305
# Test array image and proxy image interface for floating point data
315306
img_klass = self.image_class

0 commit comments

Comments
 (0)