Skip to content

Commit c185da2

Browse files
committed
MNT: Remove volumeutils.BinOpener/allopen
1 parent 7dd75f8 commit c185da2

File tree

3 files changed

+1
-46
lines changed

3 files changed

+1
-46
lines changed

nibabel/tests/test_openers.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
DeterministicGzipFile,
2424
)
2525
from ..tmpdirs import InTemporaryDirectory
26-
from ..volumeutils import BinOpener
2726
from ..optpkg import optional_package
2827

2928
import unittest
@@ -114,11 +113,6 @@ def test_Opener_various():
114113
assert fobj.fileno() != 0
115114

116115

117-
def test_BinOpener():
118-
with pytest.raises(ExpiredDeprecationError):
119-
BinOpener('test.txt', 'r')
120-
121-
122116
class MockIndexedGzipFile(GzipFile):
123117
def __init__(self, *args, **kwargs):
124118
self._drop_handles = kwargs.pop('drop_handles', False)

nibabel/tests/test_volumeutils.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from ..volumeutils import (array_from_file,
3030
_is_compressed_fobj,
3131
array_to_file,
32-
allopen, # for backwards compatibility
3332
fname_ext_ul_case,
3433
write_zeros,
3534
seek_tell,
@@ -49,7 +48,6 @@
4948
from ..openers import Opener, BZ2File
5049
from ..casting import (floor_log2, type_info, OK_FLOATS, shared_range)
5150

52-
from ..deprecator import ExpiredDeprecationError
5351
from ..optpkg import optional_package
5452

5553
from numpy.testing import (assert_array_almost_equal,
@@ -1042,13 +1040,6 @@ def test_fname_ext_ul_case():
10421040
assert fname_ext_ul_case('afile.TxT') == 'afile.TxT'
10431041

10441042

1045-
def test_allopen_deprecated():
1046-
# This import into volumeutils is for compatibility. The code is the
1047-
# ``openers`` module.
1048-
with pytest.raises(ExpiredDeprecationError):
1049-
fobj = allopen(__file__)
1050-
1051-
10521043
def test_shape_zoom_affine():
10531044
shape = (3, 5, 7)
10541045
zooms = (3, 2, 1)

nibabel/volumeutils.py

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
import numpy as np
2020

2121
from .casting import shared_range, OK_FLOATS
22-
from .openers import Opener, BZ2File, IndexedGzipFile
23-
from .deprecated import deprecate_with_version
22+
from .openers import BZ2File, IndexedGzipFile
2423
from .externals.oset import OrderedSet
2524
from .optpkg import optional_package
2625

@@ -1337,17 +1336,6 @@ def rec2dict(rec):
13371336
return dct
13381337

13391338

1340-
class BinOpener(Opener):
1341-
""" Deprecated class that used to handle .mgz through specialized logic."""
1342-
__doc__ = Opener.__doc__
1343-
1344-
@deprecate_with_version('BinOpener class deprecated. '
1345-
"Please use Opener class instead.",
1346-
'2.1', '4.0')
1347-
def __init__(self, *args, **kwargs):
1348-
return super(BinOpener, self).__init__(*args, **kwargs)
1349-
1350-
13511339
def fname_ext_ul_case(fname):
13521340
""" `fname` with ext changed to upper / lower case if file exists
13531341
@@ -1378,21 +1366,3 @@ def fname_ext_ul_case(fname):
13781366
if exists(mod_fname):
13791367
return mod_fname
13801368
return fname
1381-
1382-
1383-
@deprecate_with_version('allopen is deprecated. '
1384-
'Please use "Opener" class instead.',
1385-
'2.0', '4.0')
1386-
def allopen(fileish, *args, **kwargs):
1387-
""" Compatibility wrapper for old ``allopen`` function
1388-
1389-
Wraps creation of ``Opener`` instance, while picking up module global
1390-
``default_compresslevel``.
1391-
1392-
Please see docstring of ``Opener`` for details.
1393-
"""
1394-
1395-
class MyOpener(Opener):
1396-
default_compresslevel = default_compresslevel
1397-
1398-
return MyOpener(fileish, *args, **kwargs)

0 commit comments

Comments
 (0)