Skip to content

Commit ae1bd4f

Browse files
committed
RF: make six dependency, remove OrderedDict module
Depend on six, use six directly, test deprecated nibabel.externals.six import. Remove implementation of OrderedDict for Python 2.6, but leave shim in place, presumably it will die a natural death. Note that, we can't test six==1.3 as a dependency, because setuptools needs something later already.
1 parent 227f56d commit ae1bd4f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+95
-609
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ addons:
2020
- libatlas-base-dev
2121
env:
2222
global:
23-
- DEPENDS="numpy scipy matplotlib h5py pillow"
23+
- DEPENDS="six numpy scipy matplotlib h5py pillow"
2424
- PYDICOM=1
2525
- INSTALL_TYPE="setup"
2626
- EXTRA_WHEELS="https://5cf40426d9f06eb7461d-6fe47d9331aba7cd62fc36c7196769e4.ssl.cf2.rackcdn.com"
@@ -37,7 +37,7 @@ matrix:
3737
# Absolute minimum dependencies
3838
- python: 2.7
3939
env:
40-
- DEPENDS=numpy==1.6.0 PYDICOM=0
40+
- DEPENDS="numpy==1.6.0" PYDICOM=0
4141
# Absolute minimum dependencies plus oldest MPL
4242
# Check these against:
4343
# nibabel/info.py

bin/nib-ls

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ import numpy as np
1919
import nibabel as nib
2020

2121
from math import ceil
22-
from collections import defaultdict
2322
from optparse import OptionParser, Option
2423
from io import StringIO
2524
from nibabel.py3k import asunicode
26-
from nibabel.externals.six.moves import xrange
2725

2826
__author__ = 'Yaroslav Halchenko'
2927
__copyright__ = 'Copyright (c) 2011-2016 Yaroslav Halchenko ' \

doc/source/installation.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ Requirements
8888
8989
* Python_ 2.7, or >= 3.4
9090
* NumPy_ 1.6 or greater
91+
* Six_ 1.3 or greater
9192
* SciPy_ (optional, for full SPM-ANALYZE support)
9293
* PyDICOM_ 0.9.7 or greater (optional, for DICOM support)
9394
* `Python Imaging Library`_ (optional, for PNG conversion in DICOMFS)

nibabel/affines.py

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

66
import numpy as np
77

8-
from .externals.six.moves import reduce
8+
from six.moves import reduce
99

1010

1111
class AffineError(ValueError):

nibabel/benchmarks/bench_load_save.py

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

2020
import numpy as np
2121

22-
from ..externals.six import BytesIO
22+
from six import BytesIO
2323

2424
from .. import Nifti1Image
2525

nibabel/benchmarks/bench_streamlines.py

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

1818
import numpy as np
1919

20-
from nibabel.externals.six.moves import zip
20+
from six.moves import zip
2121
from nibabel.tmpdirs import InTemporaryDirectory
2222

2323
from numpy.testing import assert_array_equal

nibabel/data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from os.path import join as pjoin
99
import glob
1010
import sys
11-
from .externals.six.moves import configparser
11+
from six.moves import configparser
1212
from distutils.version import LooseVersion
1313

1414
from .environment import get_nipy_user_dir, get_nipy_system_dir

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 .externals.six import BytesIO
25+
from six import BytesIO
2626

2727
from .nifti1 import Nifti1Header
2828

nibabel/eulerangles.py

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

8686
import math
8787

88-
from .externals.six.moves import reduce
88+
from six.moves import reduce
8989

9090
import numpy as np
9191

nibabel/externals/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# init for externals package
2-
try:
3-
from collections import OrderedDict
4-
except ImportError: # < Python 2.7
5-
from .ordereddict import OrderedDict
2+
from collections import OrderedDict
3+
4+
from ..deprecated import ModuleProxy as _ModuleProxy
5+
six = _ModuleProxy('nibabel.externals.six')

nibabel/externals/netcdf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@
3535
from operator import mul
3636
from mmap import mmap, ACCESS_READ
3737

38-
import numpy as np
38+
import numpy as np # noqa
3939
from ..py3k import asbytes, asstr
4040
from numpy import fromstring, ndarray, dtype, empty, array, asarray
4141
from numpy import little_endian as LITTLE_ENDIAN
4242
from functools import reduce
4343

44-
from .six import integer_types
44+
from six import integer_types
4545

4646

4747
ABSENT = b'\x00\x00\x00\x00\x00\x00\x00\x00'

nibabel/externals/ordereddict.py

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

0 commit comments

Comments
 (0)