Skip to content
Snippets Groups Projects
Commit e57c406d authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

RF: Avoid various warnings

parent fe8d6524
No related branches found
No related tags found
No related merge requests found
......@@ -814,7 +814,8 @@ class Image(Nifti):
if indexed is not False:
warnings.warn('The indexed argument is deprecated '
'and has no effect',
category=DeprecationWarning)
category=DeprecationWarning,
stacklevel=2)
if loadData:
threaded = False
......
......@@ -37,9 +37,10 @@ get their definitions straight:
"""
import logging
import collections
import itertools as it
import logging
import collections
import collections.abc as abc
import itertools as it
import numpy as np
import nibabel as nib
......@@ -689,7 +690,7 @@ class ImageWrapper(notifier.Notifier):
# If we are slicing a scalar, the
# assigned value has to be scalar.
if expNdims == 0 and isinstance(values, collections.Sequence):
if expNdims == 0 and isinstance(values, abc.Sequence):
if len(values) > 1:
raise IndexError('Invalid assignment: [{}] = {}'.format(
......@@ -828,7 +829,7 @@ def sliceObjToSliceTuple(sliceobj, shape):
# The sliceobj could be a single sliceobj
# or integer, instead of a tuple
if not isinstance(sliceobj, collections.Sequence):
if not isinstance(sliceobj, abc.Sequence):
sliceobj = [sliceobj]
# Turn e.g. array[6] into array[6, :, :]
......
......@@ -34,9 +34,9 @@ And a few more functions are provided for working with vectors:
normalise
"""
import numpy as np
import numpy.linalg as linalg
import collections
import numpy as np
import numpy.linalg as linalg
import collections.abc as abc
def invert(x):
......@@ -94,7 +94,7 @@ def scaleOffsetXform(scales, offsets):
:returns: A ``numpy.float32`` array of size :math:`4 \\times 4`.
"""
oktypes = (collections.Sequence, np.ndarray)
oktypes = (abc.Sequence, np.ndarray)
if not isinstance(scales, oktypes): scales = [scales]
if not isinstance(offsets, oktypes): offsets = [offsets]
......@@ -398,7 +398,7 @@ def axisBounds(shape,
if axes is None:
axes = [0, 1, 2]
elif not isinstance(axes, collections.Iterable):
elif not isinstance(axes, abc.Iterable):
scalar = True
axes = [axes]
......@@ -507,13 +507,13 @@ def _fillPoints(p, axes):
or an ``N*2`` or ``N*3`` array.
"""
if not isinstance(p, collections.Iterable): p = [p]
if not isinstance(p, abc.Iterable): p = [p]
p = np.array(p)
if axes is None: return p
if not isinstance(axes, collections.Iterable): axes = [axes]
if not isinstance(axes, abc.Iterable): axes = [axes]
if p.ndim == 1:
p = p.reshape((len(p), 1))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment