Skip to content

Commit 54951c0

Browse files
authored
Merge pull request #852 from effigies/mnt/deprecations
MNT: Scheduled removals for 3.0
2 parents d8cf1a9 + 64f9961 commit 54951c0

File tree

13 files changed

+29
-120
lines changed

13 files changed

+29
-120
lines changed

nibabel/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ def teardown_package():
7878
from .minc2 import Minc2Image
7979
from .cifti2 import Cifti2Header, Cifti2Image
8080
from .gifti import GiftiImage
81-
# Deprecated backwards compatiblity for MINC1
82-
from .deprecated import ModuleProxy as _ModuleProxy
83-
minc = _ModuleProxy('nibabel.minc')
8481
from .minc1 import MincImage
8582
from .freesurfer import MGHImage
8683
from .funcs import (squeeze_image, concat_images, four_to_three,
@@ -89,6 +86,7 @@ def teardown_package():
8986
flip_axis, OrientationError,
9087
apply_orientation, aff2axcodes)
9188
from .imageclasses import class_map, ext_map, all_image_classes
89+
from .deprecated import ModuleProxy as _ModuleProxy
9290
trackvis = _ModuleProxy('nibabel.trackvis')
9391
from . import mriutils
9492
from . import streamlines

nibabel/analyze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -939,7 +939,7 @@ def from_file_map(klass, file_map, mmap=True, keep_file_open=None):
939939
940940
.. deprecated:: 2.4.1
941941
``keep_file_open='auto'`` is redundant with `False` and has
942-
been deprecated. It will raise an error in nibabel 3.0.
942+
been deprecated. It raises an error as of nibabel 3.0.
943943
944944
Parameters
945945
----------

nibabel/arrayproxy.py

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
"""
2828
from contextlib import contextmanager
2929
from threading import RLock
30-
import warnings
3130

3231
import numpy as np
3332

@@ -48,15 +47,13 @@
4847
4948
If this flag is set to ``True``, a single file handle is created and used. If
5049
``False``, a new file handle is created every time the image is accessed.
51-
If this flag is set to ``'auto'``, a ``DeprecationWarning`` will be raised, which
52-
will become a ``ValueError`` in nibabel 3.0.0.
5350
5451
If this is set to any other value, attempts to create an ``ArrayProxy`` without
5552
specifying the ``keep_file_open`` flag will result in a ``ValueError`` being
5653
raised.
5754
5855
.. warning:: Setting this flag to a value of ``'auto'`` became deprecated
59-
behaviour in version 2.4.1. Support for ``'auto'`` will be removed
56+
behaviour in version 2.4.1. Support for ``'auto'`` was removed
6057
in version 3.0.0.
6158
"""
6259
KEEP_FILE_OPEN_DEFAULT = False
@@ -102,7 +99,7 @@ def __init__(self, file_like, spec, mmap=True, keep_file_open=None):
10299
103100
.. deprecated:: 2.4.1
104101
``keep_file_open='auto'`` is redundant with `False` and has
105-
been deprecated. It will raise an error in nibabel 3.0.
102+
been deprecated. It raises an error as of nibabel 3.0.
106103
107104
Parameters
108105
----------
@@ -239,14 +236,14 @@ def _should_keep_file_open(self, file_like, keep_file_open):
239236
240237
.. deprecated:: 2.4.1
241238
``keep_file_open='auto'`` is redundant with `False` and has
242-
been deprecated. It will be removed in nibabel 3.0.
239+
been deprecated. It raises an error as of nibabel 3.0.
243240
244241
Parameters
245242
----------
246243
247244
file_like : object
248245
File-like object or filename, as passed to ``__init__``.
249-
keep_file_open : { 'auto', True, False }
246+
keep_file_open : { True, False }
250247
Flag as passed to ``__init__``.
251248
252249
Returns
@@ -259,23 +256,17 @@ def _should_keep_file_open(self, file_like, keep_file_open):
259256
"""
260257
if keep_file_open is None:
261258
keep_file_open = KEEP_FILE_OPEN_DEFAULT
262-
if keep_file_open == 'auto':
263-
warnings.warn("Setting nibabel.arrayproxy.KEEP_FILE_OPEN_DEFAULT to 'auto' is "
264-
"deprecated and will become an error in v3.0.", DeprecationWarning)
265-
if keep_file_open == 'auto':
266-
warnings.warn("A value of 'auto' for keep_file_open is deprecated and will become an "
267-
"error in v3.0. You probably want False.", DeprecationWarning)
259+
if keep_file_open not in (True, False):
260+
raise ValueError("nibabel.arrayproxy.KEEP_FILE_OPEN_DEFAULT must be boolean. "
261+
"Found: {}".format(keep_file_open))
268262
elif keep_file_open not in (True, False):
269-
raise ValueError('keep_file_open should be one of {None, True, False}')
263+
raise ValueError('keep_file_open must be one of {None, True, False}')
270264

271265
# file_like is a handle - keep_file_open is irrelevant
272266
if hasattr(file_like, 'read') and hasattr(file_like, 'seek'):
273267
return False, False
274268
# if the file is a gzip file, and we have_indexed_gzip,
275269
have_igzip = openers.HAVE_INDEXED_GZIP and file_like.endswith('.gz')
276-
# XXX Remove in v3.0
277-
if keep_file_open == 'auto':
278-
return have_igzip, have_igzip
279270

280271
persist_opener = keep_file_open or have_igzip
281272
return keep_file_open, persist_opener

nibabel/brikhead.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def __init__(self, file_like, header, mmap=True, keep_file_open=None):
227227
228228
.. deprecated:: 2.4.1
229229
``keep_file_open='auto'`` is redundant with `False` and has
230-
been deprecated. It will raise an error in nibabel 3.0.
230+
been deprecated. It raises an error as of nibabel 3.0.
231231
232232
Parameters
233233
----------
@@ -511,7 +511,7 @@ def from_file_map(klass, file_map, mmap=True, keep_file_open=None):
511511
512512
.. deprecated:: 2.4.1
513513
``keep_file_open='auto'`` is redundant with `False` and has
514-
been deprecated. It will raise an error in nibabel 3.0.
514+
been deprecated. It raises an error as of nibabel 3.0.
515515
516516
Parameters
517517
----------

nibabel/checkwarns.py

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

nibabel/dataobj_images.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def from_file_map(klass, file_map, mmap=True, keep_file_open=None):
421421
422422
.. deprecated:: 2.4.1
423423
``keep_file_open='auto'`` is redundant with `False` and has
424-
been deprecated. It will raise an error in nibabel 3.0.
424+
been deprecated. It raises an error as of nibabel 3.0.
425425
426426
Parameters
427427
----------
@@ -459,7 +459,7 @@ def from_filename(klass, filename, mmap=True, keep_file_open=None):
459459
460460
.. deprecated:: 2.4.1
461461
``keep_file_open='auto'`` is redundant with `False` and has
462-
been deprecated. It will raise an error in nibabel 3.0.
462+
been deprecated. It raises an error as of nibabel 3.0.
463463
464464
Parameters
465465
----------

nibabel/deprecated.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ class ModuleProxy(object):
2020
2121
::
2222
arr = np.arange(24).reshape((2, 3, 4))
23-
minc = ModuleProxy('nibabel.minc')
24-
minc_image = minc.Minc1Image(arr, np.eye(4))
23+
nifti1 = ModuleProxy('nibabel.nifti1')
24+
nifti1_image = nifti1.Nifti1Image(arr, np.eye(4))
2525
26-
So, the ``minc`` object is a proxy that will import the required module
26+
So, the ``nifti1`` object is a proxy that will import the required module
2727
when you do attribute access and return the attributes of the imported
2828
module.
2929
"""

nibabel/freesurfer/mghformat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ def from_file_map(klass, file_map, mmap=True, keep_file_open=None):
543543
544544
.. deprecated:: 2.4.1
545545
``keep_file_open='auto'`` is redundant with `False` and has
546-
been deprecated. It will raise an error in nibabel 3.0.
546+
been deprecated. It raises an error as of nibabel 3.0.
547547
548548
Parameters
549549
----------

nibabel/minc.py

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

nibabel/spm99analyze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ def from_file_map(klass, file_map, mmap=True, keep_file_open=None):
250250
251251
.. deprecated:: 2.4.1
252252
``keep_file_open='auto'`` is redundant with `False` and has
253-
been deprecated. It will raise an error in nibabel 3.0.
253+
been deprecated. It raises an error as of nibabel 3.0.
254254
255255
Parameters
256256
----------

0 commit comments

Comments
 (0)