Skip to content

Import BytesIO from io #519

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nibabel/cifti2/parse_cifti2.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from distutils.version import LooseVersion

import numpy as np
from io import BytesIO

from .cifti2 import (Cifti2MetaData, Cifti2Header, Cifti2Label,
Cifti2LabelTable, Cifti2VertexIndices,
Expand All @@ -21,7 +22,6 @@
CIFTI_MODEL_TYPES, _underscore, Cifti2HeaderError)
from .. import xmlutils as xml
from ..spatialimages import HeaderDataError
from ..externals.six import BytesIO
from ..batteryrunners import Report
from ..nifti1 import Nifti1Extension, extension_codes, intent_codes
from ..nifti2 import Nifti2Header, Nifti2Image
Expand Down
2 changes: 1 addition & 1 deletion nibabel/dft.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

import numpy

from six import BytesIO
from io import BytesIO

from .nifti1 import Nifti1Header

Expand Down
7 changes: 3 additions & 4 deletions nibabel/freesurfer/tests/test_mghformat.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

import numpy as np

from six import BytesIO
from .. import load, save
from ...openers import ImageOpener
from ..mghformat import MGHHeader, MGHError, MGHImage
Expand Down Expand Up @@ -171,7 +170,7 @@ def test_header_updating():
mgz = load(MGZ_FNAME)
hdr = mgz.header
# Test against mri_info output
exp_aff = np.loadtxt(BytesIO(b"""
exp_aff = np.loadtxt(io.BytesIO(b"""
1.0000 2.0000 3.0000 -13.0000
2.0000 3.0000 1.0000 -11.5000
3.0000 1.0000 2.0000 -11.5000
Expand All @@ -182,7 +181,7 @@ def test_header_updating():
assert_equal(hdr['delta'], 1)
assert_almost_equal(hdr['Mdc'], exp_aff[:3, :3].T)
# Save, reload, same thing
img_fobj = BytesIO()
img_fobj = io.BytesIO()
mgz2 = _mgh_rt(mgz, img_fobj)
hdr2 = mgz2.header
assert_almost_equal(hdr2.get_affine(), exp_aff, 6)
Expand All @@ -206,7 +205,7 @@ def test_cosine_order():
aff[0] = [2, 1, 0, 10]
img = MGHImage(data, aff)
assert_almost_equal(img.affine, aff, 6)
img_fobj = BytesIO()
img_fobj = io.BytesIO()
img2 = _mgh_rt(img, img_fobj)
hdr2 = img2.header
RZS = aff[:3, :3]
Expand Down
2 changes: 1 addition & 1 deletion nibabel/spm99analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import warnings
import numpy as np

from six import BytesIO
from io import BytesIO

from .spatialimages import HeaderDataError, HeaderTypeError

Expand Down
2 changes: 1 addition & 1 deletion nibabel/streamlines/tests/test_streamlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from os.path import join as pjoin

import nibabel as nib
from six import BytesIO
from io import BytesIO
from nibabel.tmpdirs import InTemporaryDirectory

from nibabel.testing import data_path
Expand Down
2 changes: 1 addition & 1 deletion nibabel/streamlines/tests/test_trk.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import numpy as np
from os.path import join as pjoin

from six import BytesIO
from io import BytesIO

from nibabel.testing import data_path
from nibabel.testing import clear_and_catch_warnings, assert_arr_dict_equal
Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_arrayproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import warnings

from six import BytesIO
from io import BytesIO
from ..tmpdirs import InTemporaryDirectory

import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_arraywriters.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import itertools
import numpy as np

from six import BytesIO
from io import BytesIO
from ..arraywriters import (SlopeInterArrayWriter, SlopeArrayWriter,
WriterError, ScalingError, ArrayWriter,
make_array_writer, get_slope_inter)
Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_dft.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import os
from os.path import join as pjoin, dirname
from six import BytesIO
from io import BytesIO
from ..testing import suppress_warnings

import numpy as np
Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_fileholders.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
""" Testing fileholders
"""

from six import BytesIO
from io import BytesIO


from ..fileholders import FileHolder
Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_files_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import numpy as np

from .. import Nifti1Image, Nifti1Pair, MGHImage, all_image_classes
from six import BytesIO
from io import BytesIO
from ..fileholders import FileHolderError
from ..spatialimages import SpatialImage

Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_image_load_save.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ##
''' Tests for loader function '''
from __future__ import division, print_function, absolute_import
from six import BytesIO
from io import BytesIO

import shutil
from os.path import dirname, join as pjoin
Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_nifti1.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from nibabel.affines import from_matvec
from nibabel.casting import type_info, have_binary128
from nibabel.eulerangles import euler2mat
from six import BytesIO
from io import BytesIO
from nibabel.nifti1 import (load, Nifti1Header, Nifti1PairHeader, Nifti1Image,
Nifti1Pair, Nifti1Extension, Nifti1DicomExtension,
Nifti1Extensions, data_type_codes, extension_codes,
Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_round_trip.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np

from six import BytesIO
from io import BytesIO
from .. import Nifti1Image, Nifti1Header
from ..spatialimages import HeaderDataError, supported_np_types
from ..arraywriters import ScalingError
Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_scaling.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import numpy as np

from six import BytesIO
from io import BytesIO
from ..volumeutils import (calculate_scale, scale_min_max, finite_range,
apply_read_scaling, array_to_file, array_from_file)
from ..casting import type_info
Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_spatialimages.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import numpy as np

from six import BytesIO
from io import BytesIO
from ..spatialimages import (SpatialHeader, SpatialImage, HeaderDataError,
Header, ImageDataError)

Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_spm99analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import numpy as np
import itertools

from six import BytesIO
from io import BytesIO

from numpy.testing import assert_array_equal, assert_array_almost_equal, dec

Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_trackvis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import numpy as np

from six import BytesIO
from io import BytesIO
from .. import trackvis as tv
from ..orientations import aff2axcodes
from ..volumeutils import native_code, swapped_code
Expand Down
2 changes: 1 addition & 1 deletion nibabel/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import os
from os.path import exists

from six import BytesIO
from io import BytesIO
import tempfile
import warnings
import functools
Expand Down
3 changes: 2 additions & 1 deletion nibabel/tests/test_wrapstruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
import logging
import numpy as np

from six import BytesIO, StringIO
from io import BytesIO
from six import StringIO
from ..wrapstruct import WrapStructError, WrapStruct, LabeledWrapStruct
from ..batteryrunners import Report

Expand Down