From 7dbbeca3523ba90530e9a98df5f2fdc0281dc2d0 Mon Sep 17 00:00:00 2001 From: Dimitri Papadopoulos <3234522+DimitriPapadopoulos@users.noreply.github.com> Date: Thu, 31 Oct 2024 21:16:32 +0100 Subject: [PATCH] Apply ruff/pyupgrade rule UP008 UP008 Use `super()` instead of `super(__class__, self)` --- nireports/interfaces/reporting/masks.py | 12 ++++++------ nireports/interfaces/reporting/registration.py | 14 +++++++------- nireports/interfaces/reporting/segmentation.py | 14 +++++++------- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/nireports/interfaces/reporting/masks.py b/nireports/interfaces/reporting/masks.py index 4dba645c..9d9343b7 100644 --- a/nireports/interfaces/reporting/masks.py +++ b/nireports/interfaces/reporting/masks.py @@ -59,7 +59,7 @@ def _run_interface(self, runtime): if self.generate_report: self.inputs.mask = True - return super(BETRPT, self)._run_interface(runtime) + return super()._run_interface(runtime) def _post_run_hook(self, runtime): """generates a report showing slices from each axis of an arbitrary @@ -76,7 +76,7 @@ def _post_run_hook(self, runtime): self._mask_file, ) - return super(BETRPT, self)._post_run_hook(runtime) + return super()._post_run_hook(runtime) class _BrainExtractionInputSpecRPT( @@ -114,7 +114,7 @@ def _post_run_hook(self, runtime): self._mask_file, ) - return super(BrainExtractionRPT, self)._post_run_hook(runtime) + return super()._post_run_hook(runtime) class _ACompCorInputSpecRPT(nrb._SVGReportCapableInputSpec, confounds.CompCorInputSpec): @@ -148,7 +148,7 @@ def _post_run_hook(self, runtime): self._mask_file, ) - return super(ACompCorRPT, self)._post_run_hook(runtime) + return super()._post_run_hook(runtime) class _TCompCorInputSpecRPT(nrb._SVGReportCapableInputSpec, confounds.TCompCorInputSpec): @@ -184,7 +184,7 @@ def _post_run_hook(self, runtime): self.aggregate_outputs(runtime=runtime).high_variance_masks, ) - return super(TCompCorRPT, self)._post_run_hook(runtime) + return super()._post_run_hook(runtime) class _SimpleShowMaskInputSpec(nrb._SVGReportCapableInputSpec): @@ -201,7 +201,7 @@ def _post_run_hook(self, runtime): self._seg_files = [self.inputs.mask_file] self._masked = True - return super(SimpleShowMaskRPT, self)._post_run_hook(runtime) + return super()._post_run_hook(runtime) class _ROIsPlotInputSpecRPT(nrb._SVGReportCapableInputSpec): diff --git a/nireports/interfaces/reporting/registration.py b/nireports/interfaces/reporting/registration.py index 4b817db2..2d0fe983 100644 --- a/nireports/interfaces/reporting/registration.py +++ b/nireports/interfaces/reporting/registration.py @@ -67,7 +67,7 @@ def _post_run_hook(self, runtime): self._moving_image, ) - return super(ApplyTOPUPRPT, self)._post_run_hook(runtime) + return super()._post_run_hook(runtime) class _FUGUEInputSpecRPT(nrb._SVGReportCapableInputSpec, fsl.preprocess.FUGUEInputSpec): @@ -94,7 +94,7 @@ def _post_run_hook(self, runtime): self._moving_image, ) - return super(FUGUERPT, self)._post_run_hook(runtime) + return super()._post_run_hook(runtime) class _FLIRTInputSpecRPT(nrb._SVGReportCapableInputSpec, fsl.preprocess.FLIRTInputSpec): @@ -119,7 +119,7 @@ def _post_run_hook(self, runtime): self._moving_image, ) - return super(FLIRTRPT, self)._post_run_hook(runtime) + return super()._post_run_hook(runtime) class _ApplyXFMInputSpecRPT(nrb._SVGReportCapableInputSpec, fsl.preprocess.ApplyXFMInputSpec): @@ -183,7 +183,7 @@ def _post_run_hook(self, runtime): self._moving_image, ) - return super(BBRegisterRPT, self)._post_run_hook(runtime) + return super()._post_run_hook(runtime) class _MRICoregInputSpecRPT(nrb._SVGReportCapableInputSpec, fs.registration.MRICoregInputSpec): @@ -230,7 +230,7 @@ def _post_run_hook(self, runtime): self._moving_image, ) - return super(MRICoregRPT, self)._post_run_hook(runtime) + return super()._post_run_hook(runtime) class _SimpleBeforeAfterInputSpecRPT(nrb._SVGReportCapableInputSpec): @@ -259,7 +259,7 @@ def _post_run_hook(self, runtime): self._moving_image, ) - return super(SimpleBeforeAfterRPT, self)._post_run_hook(runtime) + return super()._post_run_hook(runtime) class _ResampleBeforeAfterInputSpecRPT(_SimpleBeforeAfterInputSpecRPT): @@ -291,7 +291,7 @@ def _post_run_hook(self, runtime): self._moving_image, ) - runtime = super(ResampleBeforeAfterRPT, self)._post_run_hook(runtime) + runtime = super()._post_run_hook(runtime) _LOGGER.info("Successfully created report (%s)", self._out_report) os.unlink(fname) diff --git a/nireports/interfaces/reporting/segmentation.py b/nireports/interfaces/reporting/segmentation.py index d1213322..bcff725f 100644 --- a/nireports/interfaces/reporting/segmentation.py +++ b/nireports/interfaces/reporting/segmentation.py @@ -50,7 +50,7 @@ def _run_interface(self, runtime): if self.generate_report: self.inputs.segments = True - return super(FASTRPT, self)._run_interface(runtime) + return super()._run_interface(runtime) def _post_run_hook(self, runtime): """generates a report showing nine slices, three per axis, of an @@ -72,7 +72,7 @@ def _post_run_hook(self, runtime): outputs.tissue_class_files, ) - return super(FASTRPT, self)._post_run_hook(runtime) + return super()._post_run_hook(runtime) class _ReconAllInputSpecRPT( @@ -104,7 +104,7 @@ def _post_run_hook(self, runtime): _LOGGER.info("Generating report for ReconAll (subject %s)", outputs.subject_id) - return super(ReconAllRPT, self)._post_run_hook(runtime) + return super()._post_run_hook(runtime) class _MELODICInputSpecRPT(nrb._SVGReportCapableInputSpec, fsl.model.MELODICInputSpec): @@ -129,12 +129,12 @@ class MELODICRPT(fsl.MELODIC): _out_report = None def __init__(self, generate_report=False, **kwargs): - super(MELODICRPT, self).__init__(**kwargs) + super().__init__(**kwargs) self.generate_report = generate_report def _post_run_hook(self, runtime): # Run _post_run_hook of super class - runtime = super(MELODICRPT, self)._post_run_hook(runtime) + runtime = super()._post_run_hook(runtime) # leave early if there's nothing to do if not self.generate_report: return runtime @@ -163,7 +163,7 @@ def _post_run_hook(self, runtime): def _list_outputs(self): try: - outputs = super(MELODICRPT, self)._list_outputs() + outputs = super()._list_outputs() except NotImplementedError: outputs = {} if self._out_report is not None: @@ -221,4 +221,4 @@ def _post_run_hook(self, runtime): _LOGGER.info("Generating report for ICA AROMA") - return super(ICA_AROMARPT, self)._post_run_hook(runtime) + return super()._post_run_hook(runtime)