Skip to content

Commit f1f4cf2

Browse files
committed
fix: replace all traits.File -> File
1 parent f6273f4 commit f1f4cf2

File tree

21 files changed

+173
-171
lines changed

21 files changed

+173
-171
lines changed

nipype/algorithms/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ def _list_outputs(self):
727727

728728

729729
class AddCSVRowInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec):
730-
in_file = traits.File(
730+
in_file = File(
731731
mandatory=True, desc='Input comma-separated value (CSV) files')
732732
_outputs = traits.Dict(traits.Any, value={}, usedefault=True)
733733

nipype/interfaces/afni/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ class RemlfitInputSpec(AFNICommandInputSpec):
383383
'produces a matrix with a single column of all ones',
384384
argstr='-polort %d',
385385
xor=['matrix'])
386-
matim = traits.File(
386+
matim = File(
387387
desc='read a standard file as the matrix. You can use only Col as '
388388
'a name in GLTs with these nonstandard matrix input methods, '
389389
'since the other names come from the \'matrix\' file. '

nipype/interfaces/afni/preprocess.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ class AllineateInputSpec(AFNICommandInputSpec):
369369
'larger weights mean that voxel count more in the cost function. '
370370
'If an image file is given, the volume must be defined on the '
371371
'same grid as the base dataset')
372-
out_weight_file = traits.File(
372+
out_weight_file = File(
373373
argstr='-wtprefix %s',
374374
desc='Write the weight volume to disk as a dataset',
375375
xor=['allcostx'])
@@ -966,7 +966,7 @@ class ClipLevelInputSpec(CommandLineInputSpec):
966966
argstr='-doall',
967967
position=3,
968968
xor=('grad'))
969-
grad = traits.File(
969+
grad = File(
970970
desc='Also compute a \'gradual\' clip level as a function of voxel '
971971
'position, and output that to a dataset.',
972972
argstr='-grad %s',
@@ -1831,7 +1831,7 @@ class ROIStatsInputSpec(CommandLineInputSpec):
18311831
'a \'0\' in the output file. Only active if `num_roi` is '
18321832
'enabled.',
18331833
argstr='-zerofill %s')
1834-
roisel = traits.File(
1834+
roisel = File(
18351835
exists=True,
18361836
desc='Only considers ROIs denoted by values found in the specified '
18371837
'file. Note that the order of the ROIs as specified in the file '
@@ -2260,7 +2260,7 @@ class TCorrMapInputSpec(AFNICommandInputSpec):
22602260
polort = traits.Int(argstr='-polort %d')
22612261
bandpass = traits.Tuple(
22622262
(traits.Float(), traits.Float()), argstr='-bpass %f %f')
2263-
regress_out_timeseries = traits.File(exists=True, argstr='-ort %s')
2263+
regress_out_timeseries = File(exists=True, argstr='-ort %s')
22642264
blur_fwhm = traits.Float(argstr='-Gblur %f')
22652265
seeds_width = traits.Float(argstr='-Mseed %f', xor=('seeds'))
22662266

@@ -3249,7 +3249,7 @@ class QwarpInputSpec(AFNICommandInputSpec):
32493249
'* As with \'-wball\', the factor \'f\' should be between 1 and 100.'
32503250
'* You cannot use \'-wball\' and \'-wmask\' together!',
32513251
argstr='-wpass %s %f')
3252-
out_weight_file = traits.File(
3252+
out_weight_file = File(
32533253
argstr='-wtprefix %s',
32543254
desc='Write the weight volume to disk as a dataset')
32553255
blur = traits.List(

nipype/interfaces/afni/utils.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,7 +1397,7 @@ class LocalBistatInputSpec(AFNICommandInputSpec):
13971397
' * ALL = all of the above, in that order'
13981398
'More than one option can be used.',
13991399
argstr='-stat %s...')
1400-
mask_file = traits.File(
1400+
mask_file = File(
14011401
exists=True,
14021402
desc='mask image file name. Voxels NOT in the mask will not be used '
14031403
'in the neighborhood of any voxel. Also, a voxel NOT in the mask '
@@ -1407,13 +1407,13 @@ class LocalBistatInputSpec(AFNICommandInputSpec):
14071407
desc='Compute the mask as in program 3dAutomask.',
14081408
argstr='-automask',
14091409
xor=['weight_file'])
1410-
weight_file = traits.File(
1410+
weight_file = File(
14111411
exists=True,
14121412
desc='File name of an image to use as a weight. Only applies to '
14131413
'\'pearson\' statistics.',
14141414
argstr='-weight %s',
14151415
xor=['automask'])
1416-
out_file = traits.File(
1416+
out_file = File(
14171417
desc='Output dataset.',
14181418
argstr='-prefix %s',
14191419
name_source='in_file1',
@@ -1527,7 +1527,7 @@ class LocalstatInputSpec(AFNICommandInputSpec):
15271527
' mean, median, MAD, P2skew\n'
15281528
'More than one option can be used.',
15291529
argstr='-stat %s...')
1530-
mask_file = traits.File(
1530+
mask_file = File(
15311531
exists=True,
15321532
desc='Mask image file name. Voxels NOT in the mask will not be used '
15331533
'in the neighborhood of any voxel. Also, a voxel NOT in the '
@@ -1589,7 +1589,7 @@ class LocalstatInputSpec(AFNICommandInputSpec):
15891589
overwrite = traits.Bool(
15901590
desc='overwrite output file if it already exists',
15911591
argstr='-overwrite')
1592-
out_file = traits.File(
1592+
out_file = File(
15931593
desc='Output dataset.',
15941594
argstr='-prefix %s',
15951595
name_source='in_file',
@@ -1905,7 +1905,7 @@ class NwarpApplyInputSpec(CommandLineInputSpec):
19051905
inv_warp = traits.Bool(
19061906
desc='After the warp specified in \'-nwarp\' is computed, invert it',
19071907
argstr='-iwarp')
1908-
master = traits.File(
1908+
master = File(
19091909
exists=True,
19101910
desc='the name of the master dataset, which defines the output grid',
19111911
argstr='-master %s')
@@ -1980,10 +1980,10 @@ class NwarpApply(AFNICommandBase):
19801980

19811981
class NwarpCatInputSpec(AFNICommandInputSpec):
19821982
in_files = traits.List(
1983-
traits.Either(traits.File(),
1983+
traits.Either(File(),
19841984
traits.Tuple(
19851985
traits.Enum('IDENT', 'INV', 'SQRT', 'SQRTINV'),
1986-
traits.File())),
1986+
File())),
19871987
desc="list of tuples of 3D warps and associated functions",
19881988
mandatory=True,
19891989
argstr="%s",
@@ -2137,7 +2137,7 @@ class OneDToolPyInputSpec(AFNIPythonCommandInputSpec):
21372137
desc=
21382138
'display a list of TRs which were not censored in the specified style',
21392139
argstr='-show_trs_uncensored %s')
2140-
show_cormat_warnings = traits.File(
2140+
show_cormat_warnings = File(
21412141
desc='Write cormat warnings to a file',
21422142
argstr="-show_cormat_warnings |& tee %s",
21432143
position=-1,
@@ -2226,7 +2226,7 @@ class RefitInputSpec(CommandLineInputSpec):
22262226
desc='Associates the dataset with a specific template type, e.g. '
22272227
'TLRC, MNI, ORIG')
22282228
atrcopy = traits.Tuple(
2229-
traits.File(exists=True),
2229+
File(exists=True),
22302230
traits.Str(),
22312231
argstr='-atrcopy %s %s',
22322232
desc='Copy AFNI header attribute from the given file into the header '
@@ -2310,7 +2310,7 @@ class ReHoInputSpec(CommandLineInputSpec):
23102310
position=1,
23112311
mandatory=True,
23122312
exists=True)
2313-
out_file = traits.File(
2313+
out_file = File(
23142314
desc='Output dataset.',
23152315
argstr='-prefix %s',
23162316
name_source='in_file',
@@ -2323,7 +2323,7 @@ class ReHoInputSpec(CommandLineInputSpec):
23232323
'Kendall\'s W. This option is currently compatible only with '
23242324
'the AFNI (BRIK/HEAD) output type; the chi-squared value will '
23252325
'be the second sub-brick of the output dataset.')
2326-
mask_file = traits.File(
2326+
mask_file = File(
23272327
desc='Mask within which ReHo should be calculated voxelwise',
23282328
argstr='-mask %s')
23292329
neighborhood = traits.Enum(
@@ -2451,7 +2451,7 @@ class ResampleInputSpec(AFNICommandInputSpec):
24512451
*[traits.Float()] * 3,
24522452
argstr='-dxyz %f %f %f',
24532453
desc='resample to new dx, dy and dz')
2454-
master = traits.File(
2454+
master = File(
24552455
argstr='-master %s', desc='align dataset grid to a reference file')
24562456

24572457

@@ -3247,7 +3247,7 @@ class ZeropadInputSpec(AFNICommandInputSpec):
32473247
'and slice thickness = 2.5 mm ==> 2 slices added',
32483248
argstr='-mm',
32493249
xor=['master'])
3250-
master = traits.File(
3250+
master = File(
32513251
desc='match the volume described in dataset '
32523252
'\'mset\', where mset must have the same '
32533253
'orientation and grid spacing as dataset to be '

nipype/interfaces/base/specs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
md5, hash_infile, hash_timestamp, to_str, USING_PATHLIB2)
2626
from .traits_extension import (
2727
traits,
28+
File,
29+
Str,
2830
Undefined,
2931
isdefined,
3032
has_metadata,
@@ -373,13 +375,13 @@ class DynamicTraitedSpec(BaseTraitedSpec):
373375

374376

375377
class CommandLineInputSpec(BaseInterfaceInputSpec):
376-
args = traits.Str(argstr='%s', desc='Additional parameters to the command')
378+
args = Str(argstr='%s', desc='Additional parameters to the command')
377379
environ = traits.DictStrStr(
378380
desc='Environment variables', usedefault=True, nohash=True)
379381

380382

381383
class StdOutCommandLineInputSpec(CommandLineInputSpec):
382-
out_file = traits.File(argstr="> %s", position=-1, genfile=True)
384+
out_file = File(argstr="> %s", position=-1, genfile=True)
383385

384386

385387
class MpiCommandLineInputSpec(CommandLineInputSpec):

nipype/interfaces/dipy/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def convert_to_traits_type(dipy_type, is_file=False):
100100
elif "string" in dipy_type and not is_file:
101101
return traits.Str, is_mandatory
102102
elif "string" in dipy_type and is_file:
103-
return traits.File, is_mandatory
103+
return File, is_mandatory
104104
elif "int" in dipy_type:
105105
return traits.Int, is_mandatory
106106
elif "float" in dipy_type:

nipype/interfaces/dipy/tests/test_base.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22
from collections import namedtuple
3-
from ...base import traits, TraitedSpec, BaseInterfaceInputSpec
3+
from ...base import traits, File, TraitedSpec, BaseInterfaceInputSpec
44
from ..base import (convert_to_traits_type, create_interface_specs,
55
dipy_to_nipype_interface, DipyBaseInterface, no_dipy,
66
get_dipy_workflows)
@@ -35,10 +35,10 @@ def test_convert_to_traits_type():
3535
Res(traits.ListStr, False), Res(traits.ListFloat, False),
3636
Res(traits.ListBool, False), Res(traits.ListComplex, False),
3737
Res(traits.Str, True), Res(traits.Int, True),
38-
Res(traits.File, True), Res(traits.Float, True),
38+
Res(File, True), Res(traits.Float, True),
3939
Res(traits.Bool, True), Res(traits.Complex, True),
4040
Res(traits.Str, False), Res(traits.Int, False),
41-
Res(traits.File, False), Res(traits.Float, False),
41+
Res(File, False), Res(traits.Float, False),
4242
Res(traits.Bool, False), Res(traits.Complex, False),
4343
]
4444

nipype/interfaces/freesurfer/model.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ class SegStatsReconAllInputSpec(SegStatsInputSpec):
988988
mandatory=True,
989989
desc="Subject id being processed")
990990
# implicit
991-
ribbon = traits.File(
991+
ribbon = File(
992992
mandatory=True, exists=True, desc="Input file mri/ribbon.mgz")
993993
presurf_seg = File(exists=True, desc="Input segmentation volume")
994994
transform = File(mandatory=True, exists=True, desc="Input transform file")
@@ -1216,19 +1216,19 @@ class MS_LDAInputSpec(FSTraitedSpec):
12161216
maxlen=2,
12171217
sep=' ',
12181218
desc='pair of class labels to optimize')
1219-
weight_file = traits.File(
1219+
weight_file = File(
12201220
argstr='-weight %s',
12211221
mandatory=True,
12221222
desc='filename for the LDA weights (input or output)')
1223-
vol_synth_file = traits.File(
1223+
vol_synth_file = File(
12241224
exists=False,
12251225
argstr='-synth %s',
12261226
mandatory=True,
12271227
desc=('filename for the synthesized output '
12281228
'volume'))
1229-
label_file = traits.File(
1229+
label_file = File(
12301230
exists=True, argstr='-label %s', desc='filename of the label volume')
1231-
mask_file = traits.File(
1231+
mask_file = File(
12321232
exists=True,
12331233
argstr='-mask %s',
12341234
desc='filename of the brain mask volume')
@@ -1532,7 +1532,7 @@ class SphericalAverageInputSpec(FSTraitedSpec):
15321532
exists=False,
15331533
position=-1,
15341534
desc="Output filename")
1535-
in_average = traits.Directory(
1535+
in_average = Directory(
15361536
argstr="%s",
15371537
exists=True,
15381538
genfile=True,

nipype/interfaces/freesurfer/preprocess.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2313,7 +2313,7 @@ class NormalizeInputSpec(FSTraitedSpec):
23132313

23142314

23152315
class NormalizeOutputSpec(TraitedSpec):
2316-
out_file = traits.File(exists=False, desc="The output file for Normalize")
2316+
out_file = File(exists=False, desc="The output file for Normalize")
23172317

23182318

23192319
class Normalize(FSCommand):
@@ -2379,7 +2379,7 @@ class CANormalizeInputSpec(FSTraitedSpec):
23792379

23802380

23812381
class CANormalizeOutputSpec(TraitedSpec):
2382-
out_file = traits.File(exists=False, desc="The output file for Normalize")
2382+
out_file = File(exists=False, desc="The output file for Normalize")
23832383
control_points = File(
23842384
exists=False, desc="The output control points for Normalize")
23852385

@@ -2460,7 +2460,7 @@ class CARegisterInputSpec(FSTraitedSpecOpenMP):
24602460

24612461

24622462
class CARegisterOutputSpec(TraitedSpec):
2463-
out_file = traits.File(exists=False, desc="The output file for CARegister")
2463+
out_file = File(exists=False, desc="The output file for CARegister")
24642464

24652465

24662466
class CARegister(FSCommandOpenMP):
@@ -2540,13 +2540,13 @@ class CALabelInputSpec(FSTraitedSpecOpenMP):
25402540
desc=("Reclassify voxels at least some std"
25412541
" devs from the mean using some size"
25422542
" Gaussian window"))
2543-
label = traits.File(
2543+
label = File(
25442544
argstr="-l %s",
25452545
exists=True,
25462546
desc=
25472547
"Undocumented flag. Autorecon3 uses ../label/{hemisphere}.cortex.label as input file"
25482548
)
2549-
aseg = traits.File(
2549+
aseg = File(
25502550
argstr="-aseg %s",
25512551
exists=True,
25522552
desc=
@@ -2630,13 +2630,13 @@ class MRIsCALabelInputSpec(FSTraitedSpecOpenMP):
26302630
name_template="%s.aparc.annot",
26312631
desc="Annotated surface output file")
26322632
# optional
2633-
label = traits.File(
2633+
label = File(
26342634
argstr="-l %s",
26352635
exists=True,
26362636
desc=
26372637
"Undocumented flag. Autorecon3 uses ../label/{hemisphere}.cortex.label as input file"
26382638
)
2639-
aseg = traits.File(
2639+
aseg = File(
26402640
argstr="-aseg %s",
26412641
exists=True,
26422642
desc=
@@ -2985,13 +2985,13 @@ class ConcatenateLTAInputSpec(FSTraitedSpec):
29852985
'VOX2VOX', 'RAS2RAS', argstr='-out_type %d', desc='set final LTA type')
29862986

29872987
# Talairach options
2988-
tal_source_file = traits.File(
2988+
tal_source_file = File(
29892989
exists=True,
29902990
argstr='-tal %s',
29912991
position=-5,
29922992
requires=['tal_template_file'],
29932993
desc='if in_lta2 is talairach.xfm, specify source for talairach')
2994-
tal_template_file = traits.File(
2994+
tal_template_file = File(
29952995
exists=True,
29962996
argstr='%s',
29972997
position=-4,

nipype/interfaces/freesurfer/registration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ class RegisterAVItoTalairachInputSpec(FSTraitedSpec):
134134

135135

136136
class RegisterAVItoTalairachOutputSpec(FSScriptOutputSpec):
137-
out_file = traits.File(
137+
out_file = File(
138138
exists=False, desc="The output file for RegisterAVItoTalairach")
139139

140140

0 commit comments

Comments
 (0)