Skip to content
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
4 changes: 2 additions & 2 deletions doc/source/devel/biaps/biap_0002.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ sliced array, as in:

.. code:: python

class SomeImage(object):
class Slicer(object):
class SomeImage:
class Slicer:
def __init__(self, parent):
self.parent = parent
def __getitem__(self, slicedef):
Expand Down
4 changes: 2 additions & 2 deletions doc/tools/apigen.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
DEBUG = True


class ApiDocWriter(object):
class ApiDocWriter:
""" Class for automatic detection and parsing of API docs
to Sphinx-parsable reST format"""

Expand Down Expand Up @@ -118,7 +118,7 @@ def _get_object_name(self, line):
>>> docwriter = ApiDocWriter('sphinx')
>>> docwriter._get_object_name(" def func(): ")
'func'
>>> docwriter._get_object_name(" class Klass(object): ")
>>> docwriter._get_object_name(" class Klass: ")
'Klass'
>>> docwriter._get_object_name(" class Klass: ")
'Klass'
Expand Down
2 changes: 1 addition & 1 deletion nibabel/arraywriters.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class ScalingError(WriterError):
pass


class ArrayWriter(object):
class ArrayWriter:

def __init__(self, array, out_dtype=None, **kwargs):
r""" Initialize array writer
Expand Down
4 changes: 2 additions & 2 deletions nibabel/batteryrunners.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def chk_pixdims(hdr, fix=True):
"""


class BatteryRunner(object):
class BatteryRunner:
""" Class to run set of checks """

def __init__(self, checks):
Expand Down Expand Up @@ -174,7 +174,7 @@ def __len__(self):
return len(self._checks)


class Report(object):
class Report:

def __init__(self,
error=Exception,
Expand Down
2 changes: 1 addition & 1 deletion nibabel/cmdline/dicomfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import logging


class dummy_fuse(object):
class dummy_fuse:
"""Dummy fuse "module" so that nose does not blow during doctests"""
Fuse = object

Expand Down
4 changes: 2 additions & 2 deletions nibabel/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class BomberError(DataError, AttributeError):
pass


class Datasource(object):
class Datasource:
""" Simple class to add base path to relative path """

def __init__(self, base_path):
Expand Down Expand Up @@ -302,7 +302,7 @@ def make_datasource(pkg_def, **kwargs):
return VersionedDatasource(pth)


class Bomber(object):
class Bomber:
""" Class to raise an informative error when used """

def __init__(self, name, msg):
Expand Down
6 changes: 3 additions & 3 deletions nibabel/deprecated.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from .pkg_info import cmp_pkg_version


class ModuleProxy(object):
class ModuleProxy:
""" Proxy for module that may not yet have been imported

Parameters
Expand Down Expand Up @@ -39,12 +39,12 @@ def __repr__(self):
return f"<module proxy for {self._module_name}>"


class FutureWarningMixin(object):
class FutureWarningMixin:
""" Insert FutureWarning for object creation

Examples
--------
>>> class C(object): pass
>>> class C: pass
>>> class D(FutureWarningMixin, C):
... warn_message = "Please, don't use this class"

Expand Down
2 changes: 1 addition & 1 deletion nibabel/deprecator.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def _add_dep_doc(old_doc, dep_doc, setup='', cleanup=''):
old_lines[next_line:] + cleanup_lines + [''])


class Deprecator(object):
class Deprecator:
""" Class to make decorator marking function or method as deprecated

The decorated function / method will:
Expand Down
6 changes: 3 additions & 3 deletions nibabel/dft.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def __str__(self):
return fmt % (self.i + 1, self.si.instance_number)


class _Study(object):
class _Study:

def __init__(self, d):
self.uid = d['uid']
Expand Down Expand Up @@ -91,7 +91,7 @@ def patient_name_or_uid(self):
return self.patient_name


class _Series(object):
class _Series:

def __init__(self, d):
self.uid = d['uid']
Expand Down Expand Up @@ -219,7 +219,7 @@ def nifti_size(self):
return 352 + 2 * len(self.storage_instances) * self.columns * self.rows


class _StorageInstance(object):
class _StorageInstance:

def __init__(self, d):
self.uid = d['uid']
Expand Down
4 changes: 2 additions & 2 deletions nibabel/ecat.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def read_subheaders(fileobj, mlist, endianness):
return subheaders


class EcatSubHeader(object):
class EcatSubHeader:

_subhdrdtype = subhdr_dtype
_data_type_codes = data_type_codes
Expand Down Expand Up @@ -660,7 +660,7 @@ def data_from_fileobj(self, frame=0, orientation=None):
return data


class EcatImageArrayProxy(object):
class EcatImageArrayProxy:
""" Ecat implementation of array proxy protocol

The array proxy allows us to freeze the passed fileobj and
Expand Down
4 changes: 2 additions & 2 deletions nibabel/filebasedimages.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ImageFileError(Exception):
pass


class FileBasedHeader(object):
class FileBasedHeader:
""" Template class to implement header protocol """

@classmethod
Expand Down Expand Up @@ -60,7 +60,7 @@ def copy(self):
return deepcopy(self)


class FileBasedImage(object):
class FileBasedImage:
"""
Abstract image class with interface for loading/saving images from disk.

Expand Down
2 changes: 1 addition & 1 deletion nibabel/fileholders.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class FileHolderError(Exception):
pass


class FileHolder(object):
class FileHolder:
""" class to contain filename, fileobj and file position
"""

Expand Down
2 changes: 1 addition & 1 deletion nibabel/fileslice.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
SKIP_THRESH = 2 ** 8


class _NullLock(object):
class _NullLock:
"""Can be used as no-function dummy object in place of ``threading.lock``.
The ``_NullLock`` is an object which can be used in place of a
Expand Down
4 changes: 2 additions & 2 deletions nibabel/imageglobals.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
logger.addHandler(logging.StreamHandler())


class ErrorLevel(object):
class ErrorLevel:
""" Context manager to set log error level
"""

Expand All @@ -49,7 +49,7 @@ def __exit__(self, exc, value, tb):
return False


class LoggingOutputSuppressor(object):
class LoggingOutputSuppressor:
"""Context manager to prevent global logger from printing"""

def __enter__(self):
Expand Down
4 changes: 2 additions & 2 deletions nibabel/minc1.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class MincError(Exception):
""" Error when reading MINC files """


class Minc1File(object):
class Minc1File:
""" Class to wrap MINC1 format opened netcdf object

Although it has some of the same methods as a ``Header``, we use
Expand Down Expand Up @@ -235,7 +235,7 @@ def get_scaled_data(self, sliceobj=()):
return self._normalize(data, sliceobj)


class MincImageArrayProxy(object):
class MincImageArrayProxy:
""" MINC implementation of array proxy protocol

The array proxy allows us to freeze the passed fileobj and
Expand Down
2 changes: 1 addition & 1 deletion nibabel/minc2.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from .minc1 import Minc1File, MincHeader, Minc1Image, MincError


class Hdf5Bunch(object):
class Hdf5Bunch:
""" Make object for accessing attributes of variable
"""

Expand Down
2 changes: 1 addition & 1 deletion nibabel/nicom/dicomwrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def wrapper_from_data(dcm_data):
return SiemensWrapper(dcm_data, csa)


class Wrapper(object):
class Wrapper:
""" Class to wrap general DICOM files

Methods:
Expand Down
2 changes: 1 addition & 1 deletion nibabel/nicom/structreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
_ENDIAN_CODES = '@=<>!'


class Unpacker(object):
class Unpacker:
""" Class to unpack values from buffer object

The buffer object is usually a string. Caches compiled :mod:`struct`
Expand Down
12 changes: 6 additions & 6 deletions nibabel/nicom/tests/test_dicomwrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class FakeData(dict):
assert dw.get('some_key') is None
# Check get defers to dcm_data get

class FakeData2(object):
class FakeData2:

def get(self, key, default):
return 1
Expand Down Expand Up @@ -268,7 +268,7 @@ def test_vol_matching():
# Just to check the interface, make a pretend signature-providing
# object.

class C(object):
class C:
series_signature = {}
assert dw_empty.is_same_series(C())

Expand Down Expand Up @@ -386,7 +386,7 @@ def fake_frames(seq_name, field_name, value_seq):
each element in list is obj.<seq_name>[0].<field_name> =
value_seq[n] for n in range(N)
"""
class Fake(object):
class Fake:
pass
frames = []
for value in value_seq:
Expand All @@ -410,16 +410,16 @@ def fake_shape_dependents(div_seq, sid_seq=None, sid_dim=None):
sid_dim : int
the index of the column in 'div_seq' to use as 'sid_seq'
"""
class DimIdxSeqElem(object):
class DimIdxSeqElem:
def __init__(self, dip=(0, 0), fgp=None):
self.DimensionIndexPointer = dip
if fgp is not None:
self.FunctionalGroupPointer = fgp
class FrmContSeqElem(object):
class FrmContSeqElem:
def __init__(self, div, sid):
self.DimensionIndexValues = div
self.StackID = sid
class PerFrmFuncGrpSeqElem(object):
class PerFrmFuncGrpSeqElem:
def __init__(self, div, sid):
self.FrameContentSequence = [FrmContSeqElem(div, sid)]
# if no StackID values passed in then use the values at index 'sid_dim' in
Expand Down
2 changes: 1 addition & 1 deletion nibabel/nifti1.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
), fields=('code', 'label', 'parameters', 'niistring'))


class Nifti1Extension(object):
class Nifti1Extension:
"""Baseclass for NIfTI1 header extensions.

This class is sufficient to handle very simple text-based extensions, such
Expand Down
6 changes: 3 additions & 3 deletions nibabel/onetime.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
# -----------------------------------------------------------------------------


class ResetMixin(object):
class ResetMixin:
"""A Mixin class to add a .reset() method to users of OneTimeProperty.
By default, auto attributes once computed, become static. If they happen
Expand Down Expand Up @@ -109,7 +109,7 @@ def reset(self):
delattr(self, mname)


class OneTimeProperty(object):
class OneTimeProperty:
"""A descriptor to make special properties that become normal attributes.
This is meant to be used mostly by the auto_attr decorator in this module.
Expand Down Expand Up @@ -157,7 +157,7 @@ def auto_attr(func):
Examples
--------
>>> class MagicProp(object):
>>> class MagicProp:
... @auto_attr
... def a(self):
... return 99
Expand Down
2 changes: 1 addition & 1 deletion nibabel/openers.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def _zstd_open(filename, mode="r", *, level_or_option=None, zstd_dict=None):
level_or_option=level_or_option, zstd_dict=zstd_dict)


class Opener(object):
class Opener:
r""" Class to accept, maybe open, and context-manage file-likes / filenames

Provides context manager to close files that the constructor opened for
Expand Down
2 changes: 1 addition & 1 deletion nibabel/parrec.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ def exts2pars(exts_source):
return headers


class PARRECArrayProxy(object):
class PARRECArrayProxy:

def __init__(self, file_like, header, *, mmap=True, scaling='dv'):
""" Initialize PARREC array proxy
Expand Down
2 changes: 1 addition & 1 deletion nibabel/spatialimages.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ class ImageDataError(Exception):
pass


class SpatialFirstSlicer(object):
class SpatialFirstSlicer:
""" Slicing interface that returns a new image with an updated affine
Checks that an image's first three axes are spatial
Expand Down
4 changes: 2 additions & 2 deletions nibabel/streamlines/array_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def is_ndarray_of_int_or_bool(obj):
np.issubdtype(obj.dtype, np.bool_)))


class _BuildCache(object):
class _BuildCache:
def __init__(self, arr_seq, common_shape, dtype):
self.offsets = list(arr_seq._offsets)
self.lengths = list(arr_seq._lengths)
Expand Down Expand Up @@ -88,7 +88,7 @@ def fn_binary_op(self, value):


@_define_operators
class ArraySequence(object):
class ArraySequence:
""" Sequence of ndarrays having variable first dimension sizes.

This is a container that can store multiple ndarrays where each ndarray
Expand Down
2 changes: 1 addition & 1 deletion nibabel/streamlines/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""


class Field(object):
class Field:
""" Header fields common to multiple streamline file formats.
In IPython, use `nibabel.streamlines.Field??` to list them.
Expand Down
Loading