Skip to content

Commit 95e1fbe

Browse files
authored
Merge pull request #980 from effigies/mnt/deprecations
MNT: Remove modules, objects and attributes deprecated in 3.0
2 parents f257a6d + 816f8dc commit 95e1fbe

22 files changed

+12
-2004
lines changed

nibabel/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,13 @@
5555
from .minc2 import Minc2Image
5656
from .cifti2 import Cifti2Header, Cifti2Image
5757
from .gifti import GiftiImage
58-
from .minc1 import MincImage
5958
from .freesurfer import MGHImage
6059
from .funcs import (squeeze_image, concat_images, four_to_three,
6160
as_closest_canonical)
6261
from .orientations import (io_orientation, orientation_affine,
6362
flip_axis, OrientationError,
6463
apply_orientation, aff2axcodes)
6564
from .imageclasses import class_map, ext_map, all_image_classes
66-
from .deprecated import ModuleProxy as _ModuleProxy
67-
trackvis = _ModuleProxy('nibabel.trackvis')
6865
from . import mriutils
6966
from . import streamlines
7067
from . import viewers

nibabel/analyze.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -932,10 +932,6 @@ def set_data_dtype(self, dtype):
932932
def from_file_map(klass, file_map, *, mmap=True, keep_file_open=None):
933933
""" Class method to create image from mapping in ``file_map``
934934
935-
.. deprecated:: 2.4.1
936-
``keep_file_open='auto'`` is redundant with `False` and has
937-
been deprecated. It raises an error as of nibabel 3.0.
938-
939935
Parameters
940936
----------
941937
file_map : dict

nibabel/arrayproxy.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030

3131
import numpy as np
3232

33-
from .deprecated import deprecate_with_version
3433
from .volumeutils import array_from_file, apply_read_scaling
3534
from .fileslice import fileslice, canonical_slicers
3635
from . import openers
@@ -50,10 +49,6 @@
5049
If this is set to any other value, attempts to create an ``ArrayProxy`` without
5150
specifying the ``keep_file_open`` flag will result in a ``ValueError`` being
5251
raised.
53-
54-
.. warning:: Setting this flag to a value of ``'auto'`` became deprecated
55-
behaviour in version 2.4.1. Support for ``'auto'`` was removed
56-
in version 3.0.0.
5752
"""
5853
KEEP_FILE_OPEN_DEFAULT = False
5954

@@ -90,15 +85,10 @@ class ArrayProxy(object):
9085
"""
9186
# Assume Fortran array memory layout
9287
order = 'F'
93-
_header = None
9488

9589
def __init__(self, file_like, spec, *, mmap=True, keep_file_open=None):
9690
"""Initialize array proxy instance
9791
98-
.. deprecated:: 2.4.1
99-
``keep_file_open='auto'`` is redundant with `False` and has
100-
been deprecated. It raises an error as of nibabel 3.0.
101-
10292
Parameters
10393
----------
10494
file_like : object
@@ -146,8 +136,6 @@ def __init__(self, file_like, spec, *, mmap=True, keep_file_open=None):
146136
spec.get_data_offset(),
147137
1. if slope is None else slope,
148138
0. if inter is None else inter)
149-
# Reference to original header; we will remove this soon
150-
self._header = spec.copy()
151139
elif 2 <= len(spec) <= 5:
152140
optional = (0, 1., 0.)
153141
par = spec + optional[len(spec) - 2:]
@@ -232,10 +220,6 @@ def _should_keep_file_open(self, file_like, keep_file_open):
232220
In this case, file handle management is delegated to the
233221
``indexed_gzip`` library.
234222
235-
.. deprecated:: 2.4.1
236-
``keep_file_open='auto'`` is redundant with `False` and has
237-
been deprecated. It raises an error as of nibabel 3.0.
238-
239223
Parameters
240224
----------
241225
@@ -269,11 +253,6 @@ def _should_keep_file_open(self, file_like, keep_file_open):
269253
persist_opener = keep_file_open or have_igzip
270254
return keep_file_open, persist_opener
271255

272-
@property
273-
@deprecate_with_version('ArrayProxy.header deprecated', '2.2', '3.0')
274-
def header(self):
275-
return self._header
276-
277256
@property
278257
def shape(self):
279258
return self._shape

nibabel/benchmarks/bench_streamlines.py

Lines changed: 0 additions & 88 deletions
This file was deleted.

nibabel/brikhead.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,6 @@ def __init__(self, file_like, header, *, mmap=True, keep_file_open=None):
221221
"""
222222
Initialize AFNI array proxy
223223
224-
.. deprecated:: 2.4.1
225-
``keep_file_open='auto'`` is redundant with `False` and has
226-
been deprecated. It raises an error as of nibabel 3.0.
227-
228224
Parameters
229225
----------
230226
file_like : file-like object
@@ -504,10 +500,6 @@ def from_file_map(klass, file_map, *, mmap=True, keep_file_open=None):
504500
"""
505501
Creates an AFNIImage instance from `file_map`
506502
507-
.. deprecated:: 2.4.1
508-
``keep_file_open='auto'`` is redundant with `False` and has
509-
been deprecated. It raises an error as of nibabel 3.0.
510-
511503
Parameters
512504
----------
513505
file_map : dict

nibabel/conftest.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# Pre-load deprecated modules to avoid cluttering warnings
44
with pytest.deprecated_call():
55
import nibabel.keywordonly
6-
with pytest.deprecated_call():
7-
import nibabel.trackvis
86
with pytest.warns(FutureWarning):
97
import nibabel.py3k
108

nibabel/dataobj_images.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -404,23 +404,10 @@ 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``
419410
420-
.. deprecated:: 2.4.1
421-
``keep_file_open='auto'`` is redundant with `False` and has
422-
been deprecated. It raises an error as of nibabel 3.0.
423-
424411
Parameters
425412
----------
426413
file_map : dict
@@ -454,10 +441,6 @@ def from_file_map(klass, file_map, *, mmap=True, keep_file_open=None):
454441
def from_filename(klass, filename, *, mmap=True, keep_file_open=None):
455442
"""Class method to create image from filename `filename`
456443
457-
.. deprecated:: 2.4.1
458-
``keep_file_open='auto'`` is redundant with `False` and has
459-
been deprecated. It raises an error as of nibabel 3.0.
460-
461444
Parameters
462445
----------
463446
filename : str

nibabel/filebasedimages.py

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,9 @@ class FileBasedImage(object):
159159
itself back to the files pointed to in ``file_map``. When a file holder
160160
holds active file-like objects, then these may be affected by the
161161
initial file read; in this case, the contains file-like objects need to
162-
carry the position at which a write (with ``to_files``) should place the
162+
carry the position at which a write (with ``to_file_map``) should place the
163163
data. The ``file_map`` contents should therefore be such, that this will
164-
work:
164+
work.
165165
"""
166166
header_class = FileBasedHeader
167167
_meta_sniff_len = 0
@@ -263,14 +263,6 @@ def from_filename(klass, filename):
263263
def from_file_map(klass, file_map):
264264
raise NotImplementedError
265265

266-
@classmethod
267-
@deprecate_with_version('from_files class method is deprecated.\n'
268-
'Please use the ``from_file_map`` class method '
269-
'instead.',
270-
'1.0', '3.0')
271-
def from_files(klass, file_map):
272-
return klass.from_file_map(file_map)
273-
274266
@classmethod
275267
def filespec_to_file_map(klass, filespec):
276268
""" Make `file_map` for this class from filename `filespec`
@@ -307,14 +299,6 @@ def filespec_to_file_map(klass, filespec):
307299
file_map[key] = FileHolder(filename=fname)
308300
return file_map
309301

310-
@classmethod
311-
@deprecate_with_version('filespec_to_files class method is deprecated.\n'
312-
'Please use the "filespec_to_file_map" class '
313-
'method instead.',
314-
'1.0', '3.0')
315-
def filespec_to_files(klass, filespec):
316-
return klass.filespec_to_file_map(filespec)
317-
318302
def to_filename(self, filename):
319303
""" Write image to files implied by filename string
320304
@@ -332,21 +316,9 @@ def to_filename(self, filename):
332316
self.file_map = self.filespec_to_file_map(filename)
333317
self.to_file_map()
334318

335-
@deprecate_with_version('to_filespec method is deprecated.\n'
336-
'Please use the "to_filename" method instead.',
337-
'1.0', '3.0')
338-
def to_filespec(self, filename):
339-
self.to_filename(filename)
340-
341319
def to_file_map(self, file_map=None):
342320
raise NotImplementedError
343321

344-
@deprecate_with_version('to_files method is deprecated.\n'
345-
'Please use the "to_file_map" method instead.',
346-
'1.0', '3.0')
347-
def to_files(self, file_map=None):
348-
self.to_file_map(file_map)
349-
350322
@classmethod
351323
def make_file_map(klass, mapping=None):
352324
""" Class method to make files holder for this image type

nibabel/freesurfer/mghformat.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -537,10 +537,6 @@ def filespec_to_file_map(klass, filespec):
537537
def from_file_map(klass, file_map, *, mmap=True, keep_file_open=None):
538538
""" Class method to create image from mapping in ``file_map``
539539
540-
.. deprecated:: 2.4.1
541-
``keep_file_open='auto'`` is redundant with `False` and has
542-
been deprecated. It raises an error as of nibabel 3.0.
543-
544540
Parameters
545541
----------
546542
file_map : dict

nibabel/minc1.py

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
from .spatialimages import SpatialHeader, SpatialImage
1818
from .fileslice import canonical_slicers
1919

20-
from .deprecated import deprecate_with_version
21-
2220
_dt_dict = {
2321
('b', 'unsigned'): np.uint8,
2422
('b', 'signed__'): np.int8,
@@ -342,16 +340,3 @@ def from_file_map(klass, file_map, *, mmap=True, keep_file_open=None):
342340

343341

344342
load = Minc1Image.load
345-
346-
347-
# Backwards compatibility
348-
@deprecate_with_version('MincFile is deprecated; please use Minc1File instead',
349-
since='2.0.0', until='3.0.0', warn_class=FutureWarning)
350-
class MincFile(Minc1File):
351-
pass
352-
353-
354-
@deprecate_with_version('MincImage is deprecated; please use Minc1Image instead',
355-
since='2.0.0', until='3.0.0', warn_class=FutureWarning)
356-
class MincImage(Minc1Image):
357-
pass

0 commit comments

Comments
 (0)