Skip to content

Commit 5965d45

Browse files
authored
Merge pull request #2970 from oesteban/enh/resolve-rebase-paths
ENH: Add resolve/rebase ``BasePath`` traits methods & tests
2 parents 81231c8 + b0c80d7 commit 5965d45

File tree

25 files changed

+565
-176
lines changed

25 files changed

+565
-176
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/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
StdOutCommandLineInputSpec)
2121

2222
from .traits_extension import (
23-
traits, Undefined, isdefined,
24-
File, Directory, Str, DictStrStr, has_metadata, ImageFile,
23+
traits, Undefined, isdefined, has_metadata,
24+
File, ImageFile, Directory,
25+
Str, DictStrStr,
2526
OutputMultiObject, InputMultiObject,
2627
OutputMultiPath, InputMultiPath)
2728

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):

0 commit comments

Comments
 (0)