Skip to content

Commit 53ccf79

Browse files
authored
Merge pull request #817 from DimitriPapadopoulos/pyupgrade
MNT: Pyupgrade suggestions
2 parents 5fb2e2f + c6f6317 commit 53ccf79

File tree

20 files changed

+52
-59
lines changed

20 files changed

+52
-59
lines changed

docs/conf.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
#
31
# Configuration file for the Sphinx documentation builder.
42
#
53
# This file does only contain a selection of the most common options. For a

niworkflows/engine/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32
# emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: nil -*-
43
# vi: set ft=python sts=4 ts=4 sw=4 et:
54
"""

niworkflows/engine/workflows.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(self, name, base_dir=None):
4343
path to workflow storage
4444
4545
"""
46-
super(LiterateWorkflow, self).__init__(name, base_dir)
46+
super().__init__(name, base_dir)
4747
self.__desc__ = None
4848
self.__postdesc__ = None
4949

niworkflows/interfaces/bids.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ class BIDSDataGrabber(SimpleInterface):
253253
def __init__(self, *args, **kwargs):
254254
anat_only = kwargs.pop("anat_only")
255255
anat_derivatives = kwargs.pop("anat_derivatives", None)
256-
super(BIDSDataGrabber, self).__init__(*args, **kwargs)
256+
super().__init__(*args, **kwargs)
257257
if anat_only is not None:
258258
self._require_funcs = not anat_only
259259
self._require_t1w = anat_derivatives is None
@@ -820,12 +820,12 @@ class ReadSidecarJSON(SimpleInterface):
820820
def __init__(self, fields=None, undef_fields=False, **inputs):
821821
from bids.utils import listify
822822

823-
super(ReadSidecarJSON, self).__init__(**inputs)
823+
super().__init__(**inputs)
824824
self._fields = listify(fields or [])
825825
self._undef_fields = undef_fields
826826

827827
def _outputs(self):
828-
base = super(ReadSidecarJSON, self)._outputs()
828+
base = super()._outputs()
829829
if self._fields:
830830
base = add_traits(base, self._fields)
831831
return base

niworkflows/interfaces/fixes.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class FixHeaderApplyTransforms(ApplyTransforms):
6161

6262
def _run_interface(self, runtime, correct_return_codes=(0,)):
6363
# Run normally
64-
runtime = super(FixHeaderApplyTransforms, self)._run_interface(
64+
runtime = super()._run_interface(
6565
runtime, correct_return_codes
6666
)
6767

@@ -100,7 +100,7 @@ class FixHeaderRegistration(Registration):
100100

101101
def _run_interface(self, runtime, correct_return_codes=(0,)):
102102
# Run normally
103-
runtime = super(FixHeaderRegistration, self)._run_interface(
103+
runtime = super()._run_interface(
104104
runtime, correct_return_codes
105105
)
106106

@@ -143,12 +143,12 @@ def __init__(self, *args, **kwargs):
143143
"""Add a private property to keep the path to the right input."""
144144
self._input_image = None
145145
self._negative_values = False
146-
super(FixN4BiasFieldCorrection, self).__init__(*args, **kwargs)
146+
super().__init__(*args, **kwargs)
147147

148148
def _format_arg(self, name, trait_spec, value):
149149
if name == "input_image":
150150
return trait_spec.argstr % self._input_image
151-
return super(FixN4BiasFieldCorrection, self)._format_arg(
151+
return super()._format_arg(
152152
name, trait_spec, value
153153
)
154154

@@ -166,9 +166,9 @@ def _parse_inputs(self, skip=None):
166166
newnii.to_filename(self._input_image)
167167
self._negative_values = True
168168

169-
return super(FixN4BiasFieldCorrection, self)._parse_inputs(skip=skip)
169+
return super()._parse_inputs(skip=skip)
170170

171171
def _list_outputs(self):
172-
outputs = super(FixN4BiasFieldCorrection, self)._list_outputs()
172+
outputs = super()._list_outputs()
173173
outputs["negative_values"] = self._negative_values
174174
return outputs

niworkflows/interfaces/freesurfer.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,10 @@ def _num_vols(self):
8080
def cmdline(self):
8181
if self._num_vols() == 1:
8282
return "echo Only one time point!"
83-
return super(StructuralReference, self).cmdline
83+
return super().cmdline
8484

8585
def _list_outputs(self):
86-
outputs = super(StructuralReference, self)._list_outputs()
86+
outputs = super()._list_outputs()
8787
if self._num_vols() == 1:
8888
in_file = self.inputs.in_files[0]
8989
outputs["out_file"] = in_file
@@ -117,7 +117,7 @@ class MakeMidthickness(fs.MRIsExpand):
117117

118118
@property
119119
def cmdline(self):
120-
cmd = super(MakeMidthickness, self).cmdline
120+
cmd = super().cmdline
121121
if not isdefined(self.inputs.graymid) or len(self.inputs.graymid) < 1:
122122
return cmd
123123

@@ -217,7 +217,7 @@ def _run_interface(self, runtime):
217217
return runtime
218218

219219

220-
class TruncateLTA(object):
220+
class TruncateLTA:
221221
"""
222222
Truncate long filenames in LTA files.
223223
@@ -247,7 +247,7 @@ def _post_run_hook(self, runtime):
247247

248248
fix_lta_length(lta_file)
249249

250-
runtime = super(TruncateLTA, self)._post_run_hook(runtime)
250+
runtime = super()._post_run_hook(runtime)
251251
return runtime
252252

253253

niworkflows/interfaces/header.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,14 @@ def __init__(self, fields=None, **inputs):
6767
if isinstance(self._fields, str):
6868
self._fields = [self._fields]
6969

70-
super(CopyXForm, self).__init__(**inputs)
70+
super().__init__(**inputs)
7171

7272
add_traits(self.inputs, self._fields)
7373
for f in set(self._fields).intersection(list(inputs.keys())):
7474
setattr(self.inputs, f, inputs[f])
7575

7676
def _outputs(self):
77-
base = super(CopyXForm, self)._outputs()
77+
base = super()._outputs()
7878
if self._fields:
7979
fields = self._fields.copy()
8080
if "in_file" in fields:

niworkflows/interfaces/nilearn.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,10 @@ def _run_interface(self, runtime):
241241
self._mask_file = os.path.join(runtime.cwd, "mask_file.nii.gz")
242242

243243
runtime.returncode = 0
244-
return super(ComputeEPIMask, self)._run_interface(runtime)
244+
return super()._run_interface(runtime)
245245

246246
def _list_outputs(self):
247-
outputs = super(ComputeEPIMask, self)._list_outputs()
247+
outputs = super()._list_outputs()
248248
outputs["mask_file"] = self._mask_file
249249
return outputs
250250

@@ -261,7 +261,7 @@ def _post_run_hook(self, runtime):
261261
self._mask_file,
262262
)
263263

264-
return super(ComputeEPIMask, self)._post_run_hook(runtime)
264+
return super()._post_run_hook(runtime)
265265

266266

267267
def _enhance_t2_contrast(in_file, newpath=None, offset=0.5):

niworkflows/interfaces/norm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def __init__(self, **inputs):
148148
self._reference_image = None
149149
self.retry = 1
150150
self.terminal_output = "file"
151-
super(SpatialNormalization, self).__init__(**inputs)
151+
super().__init__(**inputs)
152152

153153
def _get_settings(self):
154154
"""

niworkflows/interfaces/patches.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def _run_interface(self, runtime):
4040
failures = 0
4141
while True:
4242
try:
43-
runtime = super(RobustACompCor, self)._run_interface(runtime)
43+
runtime = super()._run_interface(runtime)
4444
break
4545
except LinAlgError:
4646
failures += 1
@@ -63,7 +63,7 @@ def _run_interface(self, runtime):
6363
failures = 0
6464
while True:
6565
try:
66-
runtime = super(RobustTCompCor, self)._run_interface(runtime)
66+
runtime = super()._run_interface(runtime)
6767
break
6868
except LinAlgError:
6969
failures += 1

0 commit comments

Comments
 (0)