20
20
21
21
from ..base import (traits , TraitedSpec , DynamicTraitedSpec , File , Undefined ,
22
22
isdefined , OutputMultiPath , InputMultiPath , BaseInterface ,
23
- BaseInterfaceInputSpec , Str )
23
+ BaseInterfaceInputSpec , Str , SimpleInterface )
24
24
from ..io import IOBase , add_traits
25
25
from ...utils .filemanip import ensure_list , copyfile , split_filename
26
26
@@ -204,7 +204,6 @@ def _list_outputs(self):
204
204
205
205
206
206
class RenameInputSpec (DynamicTraitedSpec ):
207
-
208
207
in_file = File (exists = True , mandatory = True , desc = "file to rename" )
209
208
keep_ext = traits .Bool (
210
209
desc = ("Keep in_file extension, replace "
@@ -218,12 +217,11 @@ class RenameInputSpec(DynamicTraitedSpec):
218
217
219
218
220
219
class RenameOutputSpec (TraitedSpec ):
221
-
222
220
out_file = traits .File (
223
221
exists = True , desc = "softlink to original file with new name" )
224
222
225
223
226
- class Rename (IOBase ):
224
+ class Rename (SimpleInterface , IOBase ):
227
225
"""Change the name of a file based on a mapped format string.
228
226
229
227
To use additional inputs that will be defined at run-time, the class
@@ -303,15 +301,11 @@ def _rename(self):
303
301
304
302
def _run_interface (self , runtime ):
305
303
runtime .returncode = 0
306
- _ = copyfile (self .inputs .in_file ,
307
- os .path .join (os .getcwd (), self ._rename ()))
304
+ out_file = os .path .join (runtime .cwd , self ._rename ())
305
+ _ = copyfile (self .inputs .in_file , out_file )
306
+ self ._results ['out_file' ] = out_file
308
307
return runtime
309
308
310
- def _list_outputs (self ):
311
- outputs = self ._outputs ().get ()
312
- outputs ["out_file" ] = os .path .join (os .getcwd (), self ._rename ())
313
- return outputs
314
-
315
309
316
310
class SplitInputSpec (BaseInterfaceInputSpec ):
317
311
inlist = traits .List (
0 commit comments