Skip to content

Commit

Permalink
Apply ruff/pyupgrade rule UP008
Browse files Browse the repository at this point in the history
UP008 Use `super()` instead of `super(__class__, self)`
  • Loading branch information
DimitriPapadopoulos committed Oct 31, 2024
1 parent d950028 commit 7dbbeca
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
12 changes: 6 additions & 6 deletions nireports/interfaces/reporting/masks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand All @@ -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):
Expand Down
14 changes: 7 additions & 7 deletions nireports/interfaces/reporting/registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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)

Expand Down
14 changes: 7 additions & 7 deletions nireports/interfaces/reporting/segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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):
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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)

0 comments on commit 7dbbeca

Please sign in to comment.