4
4
"""
5
5
Various utilities
6
6
7
- Change directory to provide relative paths for doctests
8
-
9
- .. testsetup::
10
- import os
11
- filepath = os.path.dirname( os.path.realpath( __file__ ) )
12
- datadir = os.path.realpath(os.path.join(filepath, '../../testing/data'))
13
- os.chdir(datadir)
14
-
7
+ Change directory to provide relative paths for doctests
8
+ >>> import os
9
+ >>> filepath = os.path.dirname(os.path.realpath(__file__))
10
+ >>> datadir = os.path.realpath(os.path.join(filepath,
11
+ ... '../../testing/data'))
12
+ >>> os.chdir(datadir)
15
13
16
14
"""
17
15
from __future__ import print_function , division , unicode_literals , absolute_import
27
25
28
26
from ..base import (traits , TraitedSpec , DynamicTraitedSpec , File ,
29
27
Undefined , isdefined , OutputMultiPath , InputMultiPath ,
30
- BaseInterface , BaseInterfaceInputSpec )
28
+ BaseInterface , BaseInterfaceInputSpec , Str )
31
29
from ..io import IOBase , add_traits
32
30
from ...utils .filemanip import filename_to_list , copyfile , split_filename
33
31
@@ -158,11 +156,10 @@ class RenameInputSpec(DynamicTraitedSpec):
158
156
in_file = File (exists = True , mandatory = True , desc = "file to rename" )
159
157
keep_ext = traits .Bool (desc = ("Keep in_file extension, replace "
160
158
"non-extension component of name" ))
161
- format_string = traits .String (mandatory = True ,
162
- desc = ("Python formatting string for output "
163
- "template" ))
164
- parse_string = traits .String (desc = ("Python regexp parse string to define "
165
- "replacement inputs" ))
159
+ format_string = Str (mandatory = True ,
160
+ desc = "Python formatting string for output template" )
161
+ parse_string = Str (desc = "Python regexp parse string to define "
162
+ "replacement inputs" )
166
163
use_fullpath = traits .Bool (False , usedefault = True ,
167
164
desc = "Use full path as input to regex parser" )
168
165
@@ -186,6 +183,7 @@ class Rename(IOBase):
186
183
187
184
Examples
188
185
--------
186
+
189
187
>>> from nipype.interfaces.utility import Rename
190
188
>>> rename1 = Rename()
191
189
>>> rename1.inputs.in_file = "zstat1.nii.gz"
0 commit comments