Skip to content
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

MAINT: object is an implicit base for all classes #11601

Merged
merged 1 commit into from
Mar 27, 2023
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 mne/_ola.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
###############################################################################
# Class for interpolation between adjacent points

class _Interp2(object):
class _Interp2:
r"""Interpolate between two points.

Parameters
Expand Down Expand Up @@ -416,7 +416,7 @@ def _check_cola(win, nperseg, step, window_name, tol=1e-10):
return const


class _Storer(object):
class _Storer:
"""Store data in chunks."""

def __init__(self, *outs, picks=None):
Expand Down
2 changes: 1 addition & 1 deletion mne/annotations.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def _ndarray_ch_names(ch_names):


@fill_doc
class Annotations(object):
class Annotations:
"""Annotation object for annotating segments of raw data.

.. note::
Expand Down
4 changes: 2 additions & 2 deletions mne/channels/channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def set_meas_date(self, meas_date):
return self


class UpdateChannelsMixin(object):
class UpdateChannelsMixin:
"""Mixin class for Raw, Evoked, Epochs, Spectrum, AverageTFR."""

@verbose
Expand Down Expand Up @@ -980,7 +980,7 @@ def add_reference_channels(self, ref_channels):
return add_reference_channels(self, ref_channels, copy=False)


class InterpolationMixin(object):
class InterpolationMixin:
"""Mixin class for Raw, Evoked, Epochs."""

@verbose
Expand Down
2 changes: 1 addition & 1 deletion mne/channels/layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from .channels import _get_ch_info


class Layout(object):
class Layout:
"""Sensor layouts.

Layouts are typically loaded from a file using
Expand Down
2 changes: 1 addition & 1 deletion mne/channels/montage.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def make_dig_montage(ch_pos=None, nasion=None, lpa=None, rpa=None,
return DigMontage(dig=dig, ch_names=ch_names)


class DigMontage(object):
class DigMontage:
"""Montage for digitized electrode and headshape position data.

.. warning:: Montages are typically created using one of the helper
Expand Down
2 changes: 1 addition & 1 deletion mne/coreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1278,7 +1278,7 @@ def _read_surface(filename, *, on_defects):


@fill_doc
class Coregistration(object):
class Coregistration:
"""Class for MRI<->head coregistration.

Parameters
Expand Down
4 changes: 2 additions & 2 deletions mne/decoding/mixin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


class TransformerMixin(object):
class TransformerMixin:
"""Mixin class for all transformers in scikit-learn."""

def fit_transform(self, X, y=None, **fit_params):
Expand Down Expand Up @@ -33,7 +33,7 @@ def fit_transform(self, X, y=None, **fit_params):
return self.fit(X, y, **fit_params).transform(X)


class EstimatorMixin(object):
class EstimatorMixin:
"""Mixin class for estimators."""

def get_params(self, deep=True):
Expand Down
2 changes: 1 addition & 1 deletion mne/epochs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3211,7 +3211,7 @@ def read_epochs(fname, proj=True, preload=True, verbose=None):
return EpochsFIF(fname, proj, preload, verbose)


class _RawContainer(object):
class _RawContainer:
"""Helper for a raw data container."""

def __init__(self, fid, data_tag, event_samps, epoch_shape,
Expand Down
2 changes: 1 addition & 1 deletion mne/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ def concatenate_events(events, first_samps, last_samps):


@fill_doc
class AcqParserFIF(object):
class AcqParserFIF:
"""Parser for Elekta data acquisition settings.

This class parses parameters (e.g. events and averaging categories) that
Expand Down
2 changes: 1 addition & 1 deletion mne/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1880,7 +1880,7 @@ def float_array(c):
fir_window, fir_design)


class FilterMixin(object):
class FilterMixin:
"""Object for Epoch/Evoked filtering."""

@verbose
Expand Down
2 changes: 1 addition & 1 deletion mne/fixes.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def is_regressor(estimator):
}


class BaseEstimator(object):
class BaseEstimator:
"""Base class for all estimators in scikit-learn.

Notes
Expand Down
2 changes: 1 addition & 1 deletion mne/gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def locate_ieeg(info, trans, base_image, subject=None, subjects_dir=None,
return gui


class _GUIScraper(object):
class _GUIScraper:
"""Scrape GUI outputs."""

def __repr__(self):
Expand Down
2 changes: 1 addition & 1 deletion mne/gui/tests/test_coreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
pytest.importorskip('nibabel')


class TstVTKPicker(object):
class TstVTKPicker:
"""Class to test cell picking."""

def __init__(self, mesh, cell_id, event_pos):
Expand Down
4 changes: 2 additions & 2 deletions mne/inverse_sparse/mxne_optim.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ def safe_max_abs_diff(A, ia, B, ib):
return np.max(np.abs(A - B))


class _Phi(object):
class _Phi:
"""Have phi stft as callable w/o using a lambda that does not pickle."""

def __init__(self, wsize, tstep, n_coefs, n_times): # noqa: D102
Expand Down Expand Up @@ -705,7 +705,7 @@ def norm(self, z, ord=2):
return norm


class _PhiT(object):
class _PhiT:
"""Have phi.T istft as callable w/o using a lambda that does not pickle."""

def __init__(self, tstep, n_freqs, n_steps, n_times): # noqa: D102
Expand Down
4 changes: 2 additions & 2 deletions mne/io/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2146,7 +2146,7 @@ def _get_scaling(ch_type, target_unit):
return scaling


class _ReadSegmentFileProtector(object):
class _ReadSegmentFileProtector:
"""Ensure only _filenames, _raw_extras, and _read_segment_file are used."""

def __init__(self, raw):
Expand All @@ -2160,7 +2160,7 @@ def _read_segment_file(self, data, idx, fi, start, stop, cals, mult):
self, data, idx, fi, start, stop, cals, mult)


class _RawShell(object):
class _RawShell:
"""Create a temporary raw object."""

def __init__(self): # noqa: D102
Expand Down
4 changes: 2 additions & 2 deletions mne/io/meas_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ def _unique_channel_names(ch_names, max_length=None, verbose=None):
return ch_names


class MontageMixin(object):
class MontageMixin:
"""Mixin for Montage getting and setting."""

@fill_doc
Expand Down Expand Up @@ -240,7 +240,7 @@ def set_montage(self, montage, match_case=True, match_alias=False,
return self


class ContainsMixin(object):
class ContainsMixin:
"""Mixin class for Raw, Evoked, Epochs and Info."""

def __contains__(self, ch_type):
Expand Down
2 changes: 1 addition & 1 deletion mne/io/open.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from ..utils import logger, verbose, _file_like, warn


class _NoCloseRead(object):
class _NoCloseRead:
"""Create a wrapper that will not close when used as a context manager."""

def __init__(self, fid):
Expand Down
2 changes: 1 addition & 1 deletion mne/io/proj.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def plot_topomap(
show=show)


class ProjMixin(object):
class ProjMixin:
"""Mixin class for Raw, Evoked, Epochs.

Notes
Expand Down
2 changes: 1 addition & 1 deletion mne/io/tag.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
##############################################################################
# HELPERS

class Tag(object):
class Tag:
"""Tag in FIF tree structure.

Parameters
Expand Down
2 changes: 1 addition & 1 deletion mne/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ def _get_label_src(label, src):
return hemi_src


class BiHemiLabel(object):
class BiHemiLabel:
"""A freesurfer/MNE label with vertices in both hemispheres.

Parameters
Expand Down
2 changes: 1 addition & 1 deletion mne/report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -3877,7 +3877,7 @@ def _recursive_search(path, pattern):
_FA_FILE_CODE = '<svg class="sg_report" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="#dec" d="M149.9 349.1l-.2-.2-32.8-28.9 32.8-28.9c3.6-3.2 4-8.8.8-12.4l-.2-.2-17.4-18.6c-3.4-3.6-9-3.7-12.4-.4l-57.7 54.1c-3.7 3.5-3.7 9.4 0 12.8l57.7 54.1c1.6 1.5 3.8 2.4 6 2.4 2.4 0 4.8-1 6.4-2.8l17.4-18.6c3.3-3.5 3.1-9.1-.4-12.4zm220-251.2L286 14C277 5 264.8-.1 252.1-.1H48C21.5 0 0 21.5 0 48v416c0 26.5 21.5 48 48 48h288c26.5 0 48-21.5 48-48V131.9c0-12.7-5.1-25-14.1-34zM256 51.9l76.1 76.1H256zM336 464H48V48h160v104c0 13.3 10.7 24 24 24h104zM209.6 214c-4.7-1.4-9.5 1.3-10.9 6L144 408.1c-1.4 4.7 1.3 9.6 6 10.9l24.4 7.1c4.7 1.4 9.6-1.4 10.9-6L240 231.9c1.4-4.7-1.3-9.6-6-10.9zm24.5 76.9l.2.2 32.8 28.9-32.8 28.9c-3.6 3.2-4 8.8-.8 12.4l.2.2 17.4 18.6c3.3 3.5 8.9 3.7 12.4.4l57.7-54.1c3.7-3.5 3.7-9.4 0-12.8l-57.7-54.1c-3.5-3.3-9.1-3.2-12.4.4l-17.4 18.6c-3.3 3.5-3.1 9.1.4 12.4z" class=""></path></svg>' # noqa: E501


class _ReportScraper(object):
class _ReportScraper:
"""Scrape Report outputs.

Only works properly if conf.py is configured properly and the file
Expand Down
4 changes: 2 additions & 2 deletions mne/simulation/raw.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ def add_chpi(raw, head_pos=None, interp='cos2', n_jobs=None, verbose=None):
return raw


class _HPIForwards(object):
class _HPIForwards:

def __init__(self, offsets, dev_head_ts, megcoils, hpi_rrs, hpi_nns):
self.offsets = offsets
Expand Down Expand Up @@ -656,7 +656,7 @@ def _stc_data_event(stc_counted, head_idx, sfreq, src=None, verts=None):
return stc_data, stim_data, verts_


class _SimForwards(object):
class _SimForwards:

def __init__(self, dev_head_ts, offsets, info, trans, src, bem, mindist,
n_jobs, meeg_picks, forward=None, use_cps=True):
Expand Down
2 changes: 1 addition & 1 deletion mne/simulation/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def simulate_stc(src, labels, stc_data, tmin, tstep, value_fun=None,
return stc


class SourceSimulator(object):
class SourceSimulator:
"""Class to generate simulated Source Estimates.

Parameters
Expand Down
6 changes: 3 additions & 3 deletions mne/surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ def _normalize_vectors(rr):
return size


class _CDist(object):
class _CDist:
"""Wrapper for cdist that uses a Tree-like pattern."""

def __init__(self, xhs):
Expand Down Expand Up @@ -513,7 +513,7 @@ def _safe_query(rr, func, reduce=False, **kwargs):
return out


class _DistanceQuery(object):
class _DistanceQuery:
"""Wrapper for fast distance queries."""

def __init__(self, xhs, method='BallTree', allow_kdtree=False):
Expand Down Expand Up @@ -596,7 +596,7 @@ def _polydata_to_surface(pd, normals=True):
return out


class _CheckInside(object):
class _CheckInside:
"""Efficiently check if points are inside a surface."""

@verbose
Expand Down
2 changes: 1 addition & 1 deletion mne/time_frequency/csd.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def pick_channels_csd(csd, include=[], exclude=[], ordered=False, copy=True):
return csd


class CrossSpectralDensity(object):
class CrossSpectralDensity:
"""Cross-spectral density.

Given a list of time series, the CSD matrix denotes for each pair of time
Expand Down
4 changes: 2 additions & 2 deletions mne/transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ def _compute_sph_harm(order, az, pol):
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

class _TPSWarp(object):
class _TPSWarp:
"""Transform points using thin-plate spline (TPS) warping.

Notes
Expand Down Expand Up @@ -1005,7 +1005,7 @@ def _tps(distsq):
###############################################################################
# Spherical harmonic approximation + TPS warp

class _SphericalSurfaceWarp(object):
class _SphericalSurfaceWarp:
"""Warp surfaces via spherical harmonic smoothing and thin-plate splines.

Notes
Expand Down
2 changes: 1 addition & 1 deletion mne/utils/_bunch.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __setattr__(self, attr, val): # noqa: D105
super().__setattr__(attr, val)


class _Named(object):
class _Named:
"""Provide shared methods for giving named-representation subclasses."""

def __new__(cls, name, val): # noqa: D102,D105
Expand Down
4 changes: 2 additions & 2 deletions mne/utils/_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ def getvalue(self, close=True):
return out


class catch_logging(object):
class catch_logging:
"""Store logging.

This will remove all other logging handlers, and return the handler to
Expand Down Expand Up @@ -334,7 +334,7 @@ def _record_warnings():
yield w


class WrapStdOut(object):
class WrapStdOut:
"""Dynamically wrap to sys.stdout.

This makes packages that monkey-patch sys.stdout (e.g.doctest,
Expand Down
4 changes: 2 additions & 2 deletions mne/utils/_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def run_command_if_main():
local_vars['run']()


class ArgvSetter(object):
class ArgvSetter:
"""Temporarily set sys.argv."""

def __init__(self, args=(), disable_stdout=True,
Expand All @@ -182,7 +182,7 @@ def __exit__(self, *args): # noqa: D105
sys.stderr = self.orig_stderr


class SilenceStdout(object):
class SilenceStdout:
"""Silence stdout."""

def __init__(self, close=True):
Expand Down
4 changes: 2 additions & 2 deletions mne/utils/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def _is_numeric(n):
return isinstance(n, numbers.Number)


class _IntLike(object):
class _IntLike:
@classmethod
def __instancecheck__(cls, other):
try:
Expand All @@ -484,7 +484,7 @@ def __instancecheck__(cls, other):
path_like = (str, Path, os.PathLike)


class _Callable(object):
class _Callable:
@classmethod
def __instancecheck__(cls, other):
return callable(other)
Expand Down
Loading