Skip to content

Commit 7958828

Browse files
committed
STY: Manual tweaks to pyupgrade+black
1 parent b8b2ab5 commit 7958828

Some content is hidden

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

77 files changed

+370
-439
lines changed

nipype/algorithms/confounds.py

+5-7
Original file line numberDiff line numberDiff line change
@@ -465,12 +465,12 @@ class CompCorInputSpec(BaseInterfaceInputSpec):
465465
"cosine",
466466
False,
467467
usedefault=True,
468-
desc="Detrend time series prior to component " "extraction",
468+
desc="Detrend time series prior to component extraction",
469469
)
470470
use_regress_poly = traits.Bool(
471471
deprecated="0.15.0",
472472
new_name="pre_filter",
473-
desc=("use polynomial regression " "pre-component extraction"),
473+
desc=("use polynomial regression pre-component extraction"),
474474
)
475475
regress_poly_degree = traits.Range(
476476
low=1, value=1, usedefault=True, desc="the degree polynomial to use"
@@ -806,7 +806,7 @@ class TCompCorInputSpec(CompCorInputSpec):
806806
class TCompCorOutputSpec(CompCorOutputSpec):
807807
# and all the fields in CompCorOutputSpec
808808
high_variance_masks = OutputMultiPath(
809-
File(exists=True), desc=("voxels exceeding the variance" " threshold")
809+
File(exists=True), desc=("voxels exceeding the variance threshold")
810810
)
811811

812812

@@ -856,7 +856,7 @@ def _process_masks(self, mask_images, timeseries=None):
856856
mask_file = os.path.abspath(f"mask_{i:03d}.nii.gz")
857857
out_image.to_filename(mask_file)
858858
IFLOGGER.debug(
859-
"tCompcor computed and saved mask of shape %s to " "mask_file %s",
859+
"tCompcor computed and saved mask of shape %s to mask_file %s",
860860
str(mask.shape),
861861
mask_file,
862862
)
@@ -1287,9 +1287,7 @@ def combine_mask_files(mask_files, mask_method=None, mask_index=None):
12871287
mask = nb.load(mask_files[mask_index])
12881288
return [mask]
12891289
raise ValueError(
1290-
("mask_index {} must be less than number of mask " "files {}").format(
1291-
mask_index, len(mask_files)
1292-
)
1290+
f"mask_index {mask_index} must be less than number of mask files {len(mask_files)}"
12931291
)
12941292
masks = []
12951293
if mask_method == "none":

nipype/algorithms/mesh.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ class ComputeMeshWarpInputSpec(BaseInterfaceInputSpec):
141141
surface1 = File(
142142
exists=True,
143143
mandatory=True,
144-
desc=("Reference surface (vtk format) to which compute " "distance."),
144+
desc=("Reference surface (vtk format) to which compute distance."),
145145
)
146146
surface2 = File(
147147
exists=True,
148148
mandatory=True,
149-
desc=("Test surface (vtk format) from which compute " "distance."),
149+
desc=("Test surface (vtk format) from which compute distance."),
150150
)
151151
metric = traits.Enum(
152152
"euclidean", "sqeuclidean", usedefault=True, desc="norm used to report distance"
@@ -163,7 +163,7 @@ class ComputeMeshWarpInputSpec(BaseInterfaceInputSpec):
163163
out_warp = File(
164164
"surfwarp.vtk",
165165
usedefault=True,
166-
desc="vtk file based on surface1 and warpings mapping it " "to surface2",
166+
desc="vtk file based on surface1 and warpings mapping it to surface2",
167167
)
168168
out_file = File(
169169
"distance.npy",
@@ -176,7 +176,7 @@ class ComputeMeshWarpOutputSpec(TraitedSpec):
176176
distance = traits.Float(desc="computed distance")
177177
out_warp = File(
178178
exists=True,
179-
desc=("vtk file with the vertex-wise " "mapping of surface1 to surface2"),
179+
desc=("vtk file with the vertex-wise mapping of surface1 to surface2"),
180180
)
181181
out_file = File(
182182
exists=True, desc="numpy file keeping computed distances and weights"
@@ -308,15 +308,15 @@ class MeshWarpMathsInputSpec(BaseInterfaceInputSpec):
308308
out_warp = File(
309309
"warp_maths.vtk",
310310
usedefault=True,
311-
desc="vtk file based on in_surf and warpings mapping it " "to out_file",
311+
desc="vtk file based on in_surf and warpings mapping it to out_file",
312312
)
313313
out_file = File("warped_surf.vtk", usedefault=True, desc="vtk with surface warped")
314314

315315

316316
class MeshWarpMathsOutputSpec(TraitedSpec):
317317
out_warp = File(
318318
exists=True,
319-
desc=("vtk file with the vertex-wise " "mapping of surface1 to surface2"),
319+
desc=("vtk file with the vertex-wise mapping of surface1 to surface2"),
320320
)
321321
out_file = File(exists=True, desc="vtk with surface warped")
322322

nipype/algorithms/misc.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,7 @@ def _run_interface(self, runtime):
870870
import pandas as pd
871871
except ImportError as e:
872872
raise ImportError(
873-
"This interface requires pandas " "(http://pandas.pydata.org/) to run."
873+
"This interface requires pandas (http://pandas.pydata.org/) to run."
874874
) from e
875875

876876
try:
@@ -1000,7 +1000,7 @@ class AddNoiseInputSpec(TraitedSpec):
10001000
)
10011001
in_mask = File(
10021002
exists=True,
1003-
desc=("input mask, voxels outside this mask " "will be considered background"),
1003+
desc=("input mask, voxels outside this mask will be considered background"),
10041004
)
10051005
snr = traits.Float(10.0, desc="desired output SNR in dB", usedefault=True)
10061006
dist = traits.Enum(
@@ -1015,7 +1015,7 @@ class AddNoiseInputSpec(TraitedSpec):
10151015
"rayleigh",
10161016
usedefault=True,
10171017
mandatory=True,
1018-
desc=("desired noise distribution, currently " "only normal is implemented"),
1018+
desc=("desired noise distribution, currently only normal is implemented"),
10191019
)
10201020
out_file = File(desc="desired output filename")
10211021

@@ -1118,7 +1118,7 @@ def gen_noise(self, image, mask=None, snr_db=10.0, dist="normal", bg_dist="norma
11181118
im_noise = np.sqrt((image + stde_1) ** 2 + (stde_2) ** 2)
11191119
else:
11201120
raise NotImplementedError(
1121-
"Only normal and rician distributions " "are supported"
1121+
"Only normal and rician distributions are supported"
11221122
)
11231123

11241124
return im_noise

nipype/algorithms/modelgen.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -614,11 +614,8 @@ def _concatenate_info(self, infolist):
614614
infoout.durations[j].extend(info.durations[j])
615615
else:
616616
raise ValueError(
617-
"Mismatch in number of onsets and \
618-
durations for run {}, condition \
619-
{}".format(
620-
i + 2, j + 1
621-
)
617+
f"Mismatch in number of onsets and durations for run {i + 2}, "
618+
f"condition {j + 1}"
622619
)
623620

624621
if hasattr(info, "amplitudes") and info.amplitudes:

nipype/algorithms/rapidart.py

+12-13
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def _calc_norm_affine(affines, use_differences, brain_pts=None):
168168
class ArtifactDetectInputSpec(BaseInterfaceInputSpec):
169169
realigned_files = InputMultiPath(
170170
File(exists=True),
171-
desc=("Names of realigned functional data " "files"),
171+
desc=("Names of realigned functional data files"),
172172
mandatory=True,
173173
)
174174
realignment_parameters = InputMultiPath(
@@ -224,12 +224,12 @@ class ArtifactDetectInputSpec(BaseInterfaceInputSpec):
224224
rotation_threshold = traits.Float(
225225
mandatory=True,
226226
xor=["norm_threshold"],
227-
desc=("Threshold (in radians) to use to " "detect rotation-related outliers"),
227+
desc=("Threshold (in radians) to use to detect rotation-related outliers"),
228228
)
229229
translation_threshold = traits.Float(
230230
mandatory=True,
231231
xor=["norm_threshold"],
232-
desc=("Threshold (in mm) to use to " "detect translation-related " "outliers"),
232+
desc=("Threshold (in mm) to use to detect translation-related outliers"),
233233
)
234234
zintensity_threshold = traits.Float(
235235
mandatory=True,
@@ -257,12 +257,12 @@ class ArtifactDetectInputSpec(BaseInterfaceInputSpec):
257257
)
258258
mask_file = File(exists=True, desc="Mask file to be used if mask_type is 'file'.")
259259
mask_threshold = traits.Float(
260-
desc=("Mask threshold to be used if mask_type" " is 'thresh'.")
260+
desc=("Mask threshold to be used if mask_type is 'thresh'.")
261261
)
262262
intersect_mask = traits.Bool(
263263
True,
264264
usedefault=True,
265-
desc=("Intersect the masks when computed from " "spm_global."),
265+
desc=("Intersect the masks when computed from spm_global."),
266266
)
267267
save_plot = traits.Bool(
268268
True, desc="save plots containing outliers", usedefault=True
@@ -288,7 +288,7 @@ class ArtifactDetectInputSpec(BaseInterfaceInputSpec):
288288
)
289289
global_threshold = traits.Float(
290290
8.0,
291-
desc=("use this threshold when mask " "type equal's spm_global"),
291+
desc=("use this threshold when mask type equal's spm_global"),
292292
usedefault=True,
293293
)
294294

@@ -312,7 +312,7 @@ class ArtifactDetectOutputSpec(TraitedSpec):
312312
),
313313
)
314314
norm_files = OutputMultiPath(
315-
File, desc=("One file for each functional run " "containing the composite norm")
315+
File, desc=("One file for each functional run containing the composite norm")
316316
)
317317
statistic_files = OutputMultiPath(
318318
File(exists=True),
@@ -329,7 +329,7 @@ class ArtifactDetectOutputSpec(TraitedSpec):
329329
plot_files = OutputMultiPath(
330330
File,
331331
desc=(
332-
"One image file for each functional run " "containing the detected outliers"
332+
"One image file for each functional run containing the detected outliers"
333333
),
334334
)
335335
mask_files = OutputMultiPath(
@@ -698,28 +698,27 @@ class StimCorrInputSpec(BaseInterfaceInputSpec):
698698
File(exists=True),
699699
mandatory=True,
700700
desc=(
701-
"Names of realignment "
702-
"parameters corresponding to "
701+
"Names of realignment parameters corresponding to "
703702
"the functional data files"
704703
),
705704
)
706705
intensity_values = InputMultiPath(
707706
File(exists=True),
708707
mandatory=True,
709-
desc=("Name of file containing intensity " "values"),
708+
desc=("Name of file containing intensity values"),
710709
)
711710
spm_mat_file = File(
712711
exists=True, mandatory=True, desc="SPM mat file (use pre-estimate SPM.mat file)"
713712
)
714713
concatenated_design = traits.Bool(
715714
mandatory=True,
716-
desc=("state if the design matrix " "contains concatenated sessions"),
715+
desc=("state if the design matrix contains concatenated sessions"),
717716
)
718717

719718

720719
class StimCorrOutputSpec(TraitedSpec):
721720
stimcorr_files = OutputMultiPath(
722-
File(exists=True), desc=("List of files containing " "correlation values")
721+
File(exists=True), desc=("List of files containing correlation values")
723722
)
724723

725724

nipype/external/cloghandler.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ def doRollover(self):
267267
except OSError:
268268
exc_value = sys.exc_info()[1]
269269
self._degrade(
270-
True, "rename failed. File in use? " "exception=%s", exc_value
270+
True, "rename failed. File in use? exception=%s", exc_value
271271
)
272272
return
273273

nipype/interfaces/afni/model.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class DeconvolveInputSpec(AFNICommandInputSpec):
196196
desc="output the sample variance (MSE) for each stimulus", argstr="-vout"
197197
)
198198
nofdr = traits.Bool(
199-
desc="Don't compute the statistic-vs-FDR curves for the bucket " "dataset.",
199+
desc="Don't compute the statistic-vs-FDR curves for the bucket dataset.",
200200
argstr="-noFDR",
201201
)
202202
global_times = traits.Bool(
@@ -218,7 +218,7 @@ class DeconvolveInputSpec(AFNICommandInputSpec):
218218
File(desc="stimulus timing file", exists=True),
219219
Str(desc="model"),
220220
),
221-
desc="generate a response model from a set of stimulus times" " given in file.",
221+
desc="generate a response model from a set of stimulus times given in file.",
222222
argstr="-stim_times %d %s '%s'...",
223223
position=-5,
224224
)
@@ -569,14 +569,14 @@ class RemlfitInputSpec(AFNICommandInputSpec):
569569

570570
class RemlfitOutputSpec(AFNICommandOutputSpec):
571571
out_file = File(
572-
desc="dataset for beta + statistics from the REML estimation (if " "generated"
572+
desc="dataset for beta + statistics from the REML estimation (if generated)"
573573
)
574574
var_file = File(desc="dataset for REML variance parameters (if generated)")
575575
rbeta_file = File(
576-
desc="dataset for beta weights from the REML estimation (if " "generated)"
576+
desc="dataset for beta weights from the REML estimation (if generated)"
577577
)
578578
rbeta_file = File(
579-
desc="output dataset for beta weights from the REML estimation (if " "generated"
579+
desc="output dataset for beta weights from the REML estimation (if generated)"
580580
)
581581
glt_file = File(
582582
desc="output dataset for beta + statistics from the REML estimation, "
@@ -585,25 +585,25 @@ class RemlfitOutputSpec(AFNICommandOutputSpec):
585585
)
586586
fitts_file = File(desc="output dataset for REML fitted model (if generated)")
587587
errts_file = File(
588-
desc="output dataset for REML residuals = data - fitted model (if " "generated"
588+
desc="output dataset for REML residuals = data - fitted model (if generated)"
589589
)
590590
wherr_file = File(
591591
desc="dataset for REML residual, whitened using the estimated "
592592
"ARMA(1,1) correlation matrix of the noise (if generated)"
593593
)
594594
ovar = File(desc="dataset for OLSQ st.dev. parameter (if generated)")
595595
obeta = File(
596-
desc="dataset for beta weights from the OLSQ estimation (if " "generated)"
596+
desc="dataset for beta weights from the OLSQ estimation (if generated)"
597597
)
598598
obuck = File(
599-
desc="dataset for beta + statistics from the OLSQ estimation (if " "generated)"
599+
desc="dataset for beta + statistics from the OLSQ estimation (if generated)"
600600
)
601601
oglt = File(
602-
desc="dataset for beta + statistics from 'gltsym' options (if " "generated"
602+
desc="dataset for beta + statistics from 'gltsym' options (if generated)"
603603
)
604604
ofitts = File(desc="dataset for OLSQ fitted model (if generated)")
605605
oerrts = File(
606-
desc="dataset for OLSQ residuals = data - fitted model (if " "generated"
606+
desc="dataset for OLSQ residuals = data - fitted model (if generated)"
607607
)
608608

609609

@@ -650,13 +650,13 @@ def _list_outputs(self):
650650

651651
class SynthesizeInputSpec(AFNICommandInputSpec):
652652
cbucket = File(
653-
desc="Read the dataset output from " "3dDeconvolve via the '-cbucket' option.",
653+
desc="Read the dataset output from 3dDeconvolve via the '-cbucket' option.",
654654
argstr="-cbucket %s",
655655
copyfile=False,
656656
mandatory=True,
657657
)
658658
matrix = File(
659-
desc="Read the matrix output from " "3dDeconvolve via the '-x1D' option.",
659+
desc="Read the matrix output from 3dDeconvolve via the '-x1D' option.",
660660
argstr="-matrix %s",
661661
copyfile=False,
662662
mandatory=True,
@@ -681,7 +681,7 @@ class SynthesizeInputSpec(AFNICommandInputSpec):
681681
argstr="-prefix %s",
682682
)
683683
dry_run = traits.Bool(
684-
desc="Don't compute the output, just " "check the inputs.", argstr="-dry"
684+
desc="Don't compute the output, just check the inputs.", argstr="-dry"
685685
)
686686
TR = traits.Float(
687687
desc="TR to set in the output. The default value of "

nipype/interfaces/afni/utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class AFNItoNIFTIInputSpec(AFNICommandInputSpec):
120120
argstr="-denote",
121121
)
122122
oldid = traits.Bool(
123-
desc="Give the new dataset the input dataset" "s AFNI ID code.",
123+
desc="Give the new dataset the input datasets AFNI ID code.",
124124
argstr="-oldid",
125125
xor=["newid"],
126126
)
@@ -1686,7 +1686,7 @@ class LocalstatInputSpec(AFNICommandInputSpec):
16861686
traits.Tuple(traits.Float, traits.Float, traits.Float),
16871687
argstr="-reduce_restore_grid %s",
16881688
xor=["reduce_max_vox", "reduce_grid"],
1689-
desc="Like reduce_grid, but also resample output back to input" "grid.",
1689+
desc="Like reduce_grid, but also resample output back to input grid.",
16901690
)
16911691
reduce_max_vox = traits.Float(
16921692
argstr="-reduce_max_vox %s",
@@ -2036,7 +2036,7 @@ class NwarpApplyInputSpec(CommandLineInputSpec):
20362036
traits.List(File(exists=True)),
20372037
mandatory=True,
20382038
argstr="-source %s",
2039-
desc="the name of the dataset to be warped " "can be multiple datasets",
2039+
desc="the name of the dataset to be warped can be multiple datasets",
20402040
)
20412041
warp = traits.String(
20422042
desc="the name of the warp dataset. "
@@ -2135,7 +2135,7 @@ class NwarpCatInputSpec(AFNICommandInputSpec):
21352135
position=-1,
21362136
)
21372137
space = traits.String(
2138-
desc="string to attach to the output dataset as its atlas space " "marker.",
2138+
desc="string to attach to the output dataset as its atlas space marker.",
21392139
argstr="-space %s",
21402140
)
21412141
inv_warp = traits.Bool(desc="invert the final warp before output", argstr="-iwarp")

0 commit comments

Comments
 (0)