Skip to content

Commit ca977ab

Browse files
authored
Merge pull request #519 from effigies/remove_six
Import BytesIO from io where possible Fixes deprecation warning in parse_cifti2
2 parents 6f58e02 + c381801 commit ca977ab

20 files changed

+23
-23
lines changed

nibabel/cifti2/parse_cifti2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from distutils.version import LooseVersion
1212

1313
import numpy as np
14+
from io import BytesIO
1415

1516
from .cifti2 import (Cifti2MetaData, Cifti2Header, Cifti2Label,
1617
Cifti2LabelTable, Cifti2VertexIndices,
@@ -21,7 +22,6 @@
2122
CIFTI_MODEL_TYPES, _underscore, Cifti2HeaderError)
2223
from .. import xmlutils as xml
2324
from ..spatialimages import HeaderDataError
24-
from ..externals.six import BytesIO
2525
from ..batteryrunners import Report
2626
from ..nifti1 import Nifti1Extension, extension_codes, intent_codes
2727
from ..nifti2 import Nifti2Header, Nifti2Image

nibabel/dft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
import numpy
2424

25-
from six import BytesIO
25+
from io import BytesIO
2626

2727
from .nifti1 import Nifti1Header
2828

nibabel/freesurfer/tests/test_mghformat.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
import numpy as np
1515

16-
from six import BytesIO
1716
from .. import load, save
1817
from ...openers import ImageOpener
1918
from ..mghformat import MGHHeader, MGHError, MGHImage
@@ -171,7 +170,7 @@ def test_header_updating():
171170
mgz = load(MGZ_FNAME)
172171
hdr = mgz.header
173172
# Test against mri_info output
174-
exp_aff = np.loadtxt(BytesIO(b"""
173+
exp_aff = np.loadtxt(io.BytesIO(b"""
175174
1.0000 2.0000 3.0000 -13.0000
176175
2.0000 3.0000 1.0000 -11.5000
177176
3.0000 1.0000 2.0000 -11.5000
@@ -182,7 +181,7 @@ def test_header_updating():
182181
assert_equal(hdr['delta'], 1)
183182
assert_almost_equal(hdr['Mdc'], exp_aff[:3, :3].T)
184183
# Save, reload, same thing
185-
img_fobj = BytesIO()
184+
img_fobj = io.BytesIO()
186185
mgz2 = _mgh_rt(mgz, img_fobj)
187186
hdr2 = mgz2.header
188187
assert_almost_equal(hdr2.get_affine(), exp_aff, 6)
@@ -206,7 +205,7 @@ def test_cosine_order():
206205
aff[0] = [2, 1, 0, 10]
207206
img = MGHImage(data, aff)
208207
assert_almost_equal(img.affine, aff, 6)
209-
img_fobj = BytesIO()
208+
img_fobj = io.BytesIO()
210209
img2 = _mgh_rt(img, img_fobj)
211210
hdr2 = img2.header
212211
RZS = aff[:3, :3]

nibabel/spm99analyze.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import warnings
1111
import numpy as np
1212

13-
from six import BytesIO
13+
from io import BytesIO
1414

1515
from .spatialimages import HeaderDataError, HeaderTypeError
1616

nibabel/streamlines/tests/test_streamlines.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from os.path import join as pjoin
77

88
import nibabel as nib
9-
from six import BytesIO
9+
from io import BytesIO
1010
from nibabel.tmpdirs import InTemporaryDirectory
1111

1212
from nibabel.testing import data_path

nibabel/streamlines/tests/test_trk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import numpy as np
66
from os.path import join as pjoin
77

8-
from six import BytesIO
8+
from io import BytesIO
99

1010
from nibabel.testing import data_path
1111
from nibabel.testing import clear_and_catch_warnings, assert_arr_dict_equal

nibabel/tests/test_arrayproxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import warnings
1414

15-
from six import BytesIO
15+
from io import BytesIO
1616
from ..tmpdirs import InTemporaryDirectory
1717

1818
import numpy as np

nibabel/tests/test_arraywriters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import itertools
1111
import numpy as np
1212

13-
from six import BytesIO
13+
from io import BytesIO
1414
from ..arraywriters import (SlopeInterArrayWriter, SlopeArrayWriter,
1515
WriterError, ScalingError, ArrayWriter,
1616
make_array_writer, get_slope_inter)

nibabel/tests/test_dft.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import os
55
from os.path import join as pjoin, dirname
6-
from six import BytesIO
6+
from io import BytesIO
77
from ..testing import suppress_warnings
88

99
import numpy as np

nibabel/tests/test_fileholders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
""" Testing fileholders
22
"""
33

4-
from six import BytesIO
4+
from io import BytesIO
55

66

77
from ..fileholders import FileHolder

0 commit comments

Comments
 (0)