Skip to content

Commit 4195b9e

Browse files
authored
Merge pull request #1 from pvelasco/black-formatting
LINT: Black edits
2 parents cd3c20f + 09a44f4 commit 4195b9e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+39
-159
lines changed

doc/devel/matlab_example1.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
from nipype.interfaces.matlab import MatlabCommand
2-
from nipype.interfaces.base import TraitedSpec, \
3-
BaseInterface, BaseInterfaceInputSpec, File
2+
from nipype.interfaces.base import (
3+
TraitedSpec,
4+
BaseInterface,
5+
BaseInterfaceInputSpec,
6+
File,
7+
)
48
import os
59
from string import Template
610

@@ -19,14 +23,15 @@ class ConmapTxt2Mat(BaseInterface):
1923
output_spec = ConmapTxt2MatOutputSpec
2024

2125
def _run_interface(self, runtime):
22-
d = dict(in_file=self.inputs.in_file,
23-
out_file=self.inputs.out_file)
26+
d = dict(in_file=self.inputs.in_file, out_file=self.inputs.out_file)
2427
# This is your MATLAB code template
25-
script = Template("""in_file = '$in_file';
28+
script = Template(
29+
"""in_file = '$in_file';
2630
out_file = '$out_file';
2731
ConmapTxt2Mat(in_file, out_file);
2832
exit;
29-
""").substitute(d)
33+
"""
34+
).substitute(d)
3035

3136
# mfile = True will create an .m file with your script and executed.
3237
# Alternatively

doc/devel/matlab_example2.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44

55

66
class HelloWorldInputSpec(MatlabInputSpec):
7-
name = traits.Str(mandatory=True,
8-
desc='Name of person to say hello to')
7+
name = traits.Str(mandatory=True, desc='Name of person to say hello to')
98

109

1110
class HelloWorldOutputSpec(TraitedSpec):
@@ -29,6 +28,7 @@ class HelloWorld(MatlabCommand):
2928
>>> out = hello.run()
3029
>>> print out.outputs.matlab_output
3130
"""
31+
3232
input_spec = HelloWorldInputSpec
3333
output_spec = HelloWorldOutputSpec
3434

@@ -37,7 +37,9 @@ def _my_script(self):
3737
script = """
3838
disp('Hello %s Python')
3939
two = 1 + 1
40-
""" % (self.inputs.name)
40+
""" % (
41+
self.inputs.name
42+
)
4143
return script
4244

4345
def run(self, **inputs):

nipype/algorithms/misc.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -968,7 +968,6 @@ class CalculateNormalizedMoments(BaseInterface):
968968
output_spec = CalculateNormalizedMomentsOutputSpec
969969

970970
def _run_interface(self, runtime):
971-
972971
self._moments = calc_moments(self.inputs.timeseries_file, self.inputs.moment)
973972
return runtime
974973

nipype/algorithms/tests/test_ErrorMap.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111

1212
def test_errormap(tmpdir):
13-
1413
# Single-Spectual
1514
# Make two fake 2*2*2 voxel volumes
1615
# John von Neumann's birthday

nipype/algorithms/tests/test_misc.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414

1515
def test_CreateNifti(create_analyze_pair_file_in_directory):
16-
1716
filelist, outdir = create_analyze_pair_file_in_directory
1817

1918
create_nifti = misc.CreateNifti()
@@ -35,7 +34,6 @@ def test_CreateNifti(create_analyze_pair_file_in_directory):
3534

3635

3736
def test_CalculateMedian(create_analyze_pair_file_in_directory):
38-
3937
mean = misc.CalculateMedian()
4038

4139
with pytest.raises(TypeError):

nipype/algorithms/tests/test_normalize_tpms.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717

1818
def test_normalize_tpms(tmpdir):
19-
2019
in_mask = example_data("tpms_msk.nii.gz")
2120
mskdata = np.asanyarray(nb.load(in_mask).dataobj)
2221
mskdata[mskdata > 0.0] = 1.0

nipype/conftest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ def _docdir(request):
2727
# Trigger ONLY for the doctests.
2828
doctest_plugin = request.config.pluginmanager.getplugin("doctest")
2929
if isinstance(request.node, doctest_plugin.DoctestItem):
30-
3130
# Get the fixture dynamically by its name.
3231
tmpdir = pp.local(data_dir)
3332

nipype/external/cloghandler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ def __init__(
151151
)
152152
try:
153153
BaseRotatingHandler.__init__(self, filename, mode, encoding)
154-
except TypeError: # Due to a different logging release without encoding support (Python 2.4.1 and earlier?)
154+
except (
155+
TypeError
156+
): # Due to a different logging release without encoding support (Python 2.4.1 and earlier?)
155157
BaseRotatingHandler.__init__(self, filename, mode)
156158
self.encoding = encoding
157159

nipype/interfaces/afni/preprocess.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,6 @@ class ClipLevel(AFNICommandBase):
11331133
output_spec = ClipLevelOutputSpec
11341134

11351135
def aggregate_outputs(self, runtime=None, needed_outputs=None):
1136-
11371136
outputs = self._outputs()
11381137

11391138
outfile = os.path.join(os.getcwd(), "stat_result.json")
@@ -2295,7 +2294,6 @@ class Seg(AFNICommandBase):
22952294
output_spec = AFNICommandOutputSpec
22962295

22972296
def aggregate_outputs(self, runtime=None, needed_outputs=None):
2298-
22992297
import glob
23002298

23012299
outputs = self._outputs()

nipype/interfaces/afni/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ class BrickStat(AFNICommandBase):
302302
output_spec = BrickStatOutputSpec
303303

304304
def aggregate_outputs(self, runtime=None, needed_outputs=None):
305-
306305
outputs = self._outputs()
307306

308307
outfile = os.path.join(os.getcwd(), "stat_result.json")
@@ -2595,7 +2594,6 @@ def _format_arg(self, name, spec, value):
25952594

25962595

25972596
class ResampleInputSpec(AFNICommandInputSpec):
2598-
25992597
in_file = File(
26002598
desc="input file to 3dresample",
26012599
argstr="-inset %s",

nipype/interfaces/base/core.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,6 @@ def run(self, cwd=None, ignore_exception=None, **inputs):
389389
self._check_version_requirements(self.inputs)
390390

391391
with rtc(self, cwd=cwd, redirect_x=self._redirect_x) as runtime:
392-
393392
# Grab inputs now, as they should not change during execution
394393
inputs = self.inputs.get_traitsfree()
395394
outputs = None

nipype/interfaces/base/traits_extension.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,6 @@ class MultiObject(traits.List):
405405
"""Abstract class - shared functionality of input and output MultiObject"""
406406

407407
def validate(self, objekt, name, value):
408-
409408
# want to treat range and other sequences (except str) as list
410409
if not isinstance(value, (str, bytes)) and isinstance(value, Sequence):
411410
value = list(value)

nipype/interfaces/brainsuite/brainsuite.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919

2020

2121
class BseInputSpec(CommandLineInputSpec):
22-
2322
inputMRIFile = File(mandatory=True, argstr="-i %s", desc="input MRI volume")
2423
outputMRIVolume = File(
2524
desc="output brain-masked MRI volume. If unspecified, output file name will be auto generated.",

nipype/interfaces/cat12/preprocess.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,6 @@ def _list_outputs(self):
537537
]
538538

539539
for tidx, tissue in enumerate(["gm", "wm", "csf"]):
540-
541540
for image, prefix in [("modulated", "mw"), ("dartel", "r"), ("native", "")]:
542541
outtype = f"{tissue}_output_{image}"
543542
if isdefined(getattr(self.inputs, outtype)) and getattr(
@@ -594,7 +593,6 @@ def _list_outputs(self):
594593

595594

596595
class CAT12SANLMDenoisingInputSpec(SPMCommandInputSpec):
597-
598596
in_files = InputMultiPath(
599597
ImageFileSPM(exists=True),
600598
field="data",
@@ -679,7 +677,6 @@ class CAT12SANLMDenoisingInputSpec(SPMCommandInputSpec):
679677

680678

681679
class CAT12SANLMDenoisingOutputSpec(TraitedSpec):
682-
683680
out_file = File(desc="out file")
684681

685682

nipype/interfaces/cmtk/cmtk.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ def cmat(
272272

273273
dis = 0
274274
for i in range(endpoints.shape[0]):
275-
276275
# ROI start => ROI end
277276
try:
278277
startROI = int(

nipype/interfaces/freesurfer/model.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -449,7 +449,6 @@ class GLMFitInputSpec(FSTraitedSpec):
449449

450450

451451
class GLMFitOutputSpec(TraitedSpec):
452-
453452
glm_dir = Directory(exists=True, desc="output directory")
454453
beta_file = File(exists=True, desc="map of regression coefficients")
455454
error_file = File(desc="map of residual error")

nipype/interfaces/freesurfer/petsurfer.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424

2525

2626
class GTMSegInputSpec(FSTraitedSpec):
27-
2827
subject_id = traits.String(argstr="--s %s", desc="subject id", mandatory=True)
2928

3029
xcerseg = traits.Bool(
@@ -136,7 +135,6 @@ def _list_outputs(self):
136135

137136

138137
class GTMPVCInputSpec(FSTraitedSpec):
139-
140138
in_file = File(
141139
exists=True,
142140
argstr="--i %s",
@@ -422,7 +420,6 @@ class GTMPVCInputSpec(FSTraitedSpec):
422420

423421

424422
class GTMPVCOutputSpec(TraitedSpec):
425-
426423
pvc_dir = Directory(desc="output directory")
427424
ref_file = File(desc="Reference TAC in .dat")
428425
hb_nifti = File(desc="High-binding TAC in nifti")

nipype/interfaces/freesurfer/preprocess.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,7 +1833,6 @@ class BBRegister(FSCommand):
18331833
output_spec = BBRegisterOutputSpec
18341834

18351835
def _list_outputs(self):
1836-
18371836
outputs = self.output_spec().get()
18381837
_in = self.inputs
18391838

@@ -1893,7 +1892,6 @@ def _format_arg(self, name, spec, value):
18931892
return super(BBRegister, self)._format_arg(name, spec, value)
18941893

18951894
def _gen_filename(self, name):
1896-
18971895
if name == "out_reg_file":
18981896
return self._list_outputs()[name]
18991897
return None
@@ -2180,7 +2178,6 @@ def _gen_filename(self, name):
21802178

21812179

21822180
class RobustRegisterInputSpec(FSTraitedSpec):
2183-
21842181
source_file = File(
21852182
exists=True, mandatory=True, argstr="--mov %s", desc="volume to be registered"
21862183
)
@@ -2302,7 +2299,6 @@ class RobustRegisterInputSpec(FSTraitedSpec):
23022299

23032300

23042301
class RobustRegisterOutputSpec(TraitedSpec):
2305-
23062302
out_reg_file = File(exists=True, desc="output registration file")
23072303
registered_file = File(exists=True, desc="output image with registration applied")
23082304
weights_file = File(exists=True, desc="image of weights used")
@@ -2388,7 +2384,6 @@ def _list_outputs(self):
23882384

23892385

23902386
class FitMSParamsInputSpec(FSTraitedSpec):
2391-
23922387
in_files = traits.List(
23932388
File(exists=True),
23942389
argstr="%s",
@@ -2408,7 +2403,6 @@ class FitMSParamsInputSpec(FSTraitedSpec):
24082403

24092404

24102405
class FitMSParamsOutputSpec(TraitedSpec):
2411-
24122406
t1_image = File(exists=True, desc="image of estimated T1 relaxation values")
24132407
pd_image = File(exists=True, desc="image of estimated proton density values")
24142408
t2star_image = File(exists=True, desc="image of estimated T2* values")
@@ -2466,7 +2460,6 @@ def _gen_filename(self, name):
24662460

24672461

24682462
class SynthesizeFLASHInputSpec(FSTraitedSpec):
2469-
24702463
fixed_weighting = traits.Bool(
24712464
position=1,
24722465
argstr="-w",
@@ -2495,7 +2488,6 @@ class SynthesizeFLASHInputSpec(FSTraitedSpec):
24952488

24962489

24972490
class SynthesizeFLASHOutputSpec(TraitedSpec):
2498-
24992491
out_file = File(exists=True, desc="synthesized FLASH acquisition")
25002492

25012493

nipype/interfaces/freesurfer/tests/test_FSSurfaceCommand.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def test_associated_file(tmpdir):
3535
("./lh.white", "./lh.pial"),
3636
(fsavginfo["white"], fsavginfo["pial"]),
3737
]:
38-
3938
# Unspecified paths, possibly with missing hemisphere information,
4039
# are equivalent to using the same directory and hemisphere
4140
for name in ("pial", "lh.pial", pial):

nipype/interfaces/freesurfer/tests/test_utils.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
@pytest.mark.skipif(fs.no_freesurfer(), reason="freesurfer is not installed")
1919
def test_sample2surf(create_files_in_directory_plus_dummy_file):
20-
2120
s2s = fs.SampleToSurface()
2221
# Test underlying command
2322
assert s2s.cmd == "mri_vol2surf"
@@ -65,7 +64,6 @@ def set_illegal_range():
6564

6665
@pytest.mark.skipif(fs.no_freesurfer(), reason="freesurfer is not installed")
6766
def test_surfsmooth(create_surf_file_in_directory):
68-
6967
smooth = fs.SurfaceSmooth()
7068

7169
# Test underlying command
@@ -104,7 +102,6 @@ def test_surfsmooth(create_surf_file_in_directory):
104102

105103
@pytest.mark.skipif(fs.no_freesurfer(), reason="freesurfer is not installed")
106104
def test_surfxfm(create_surf_file_in_directory):
107-
108105
xfm = fs.SurfaceTransform()
109106

110107
# Test underlying command
@@ -141,7 +138,6 @@ def test_surfxfm(create_surf_file_in_directory):
141138

142139
@pytest.mark.skipif(fs.no_freesurfer(), reason="freesurfer is not installed")
143140
def test_surfshots(create_files_in_directory_plus_dummy_file):
144-
145141
fotos = fs.SurfaceSnapshots()
146142

147143
# Test underlying command

0 commit comments

Comments
 (0)