3333
3434from .. import config , logging
3535from ..utils .filemanip import (
36- copyfile , list_to_filename , filename_to_list ,
36+ copyfile , simplify_list , ensure_list ,
3737 get_related_files , related_filetype_sets )
3838from ..utils .misc import human_order_sorted , str2bool
3939from .base import (
@@ -721,7 +721,7 @@ def _list_outputs(self):
721721 if not isdefined (files ):
722722 continue
723723 iflogger .debug ("key: %s files: %s" , key , str (files ))
724- files = filename_to_list (files )
724+ files = ensure_list (files )
725725 tempoutdir = outdir
726726 if s3_flag :
727727 s3tempoutdir = s3dir
@@ -738,7 +738,7 @@ def _list_outputs(self):
738738 files = [item for sublist in files for item in sublist ]
739739
740740 # Iterate through passed-in source files
741- for src in filename_to_list (files ):
741+ for src in ensure_list (files ):
742742 # Format src and dst files
743743 src = os .path .abspath (src )
744744 if not os .path .isfile (src ):
@@ -938,7 +938,7 @@ def _list_outputs(self):
938938 else :
939939 if self .inputs .sort_filelist :
940940 filelist = human_order_sorted (filelist )
941- outputs [key ] = list_to_filename (filelist )
941+ outputs [key ] = simplify_list (filelist )
942942 for argnum , arglist in enumerate (args ):
943943 maxlen = 1
944944 for arg in arglist :
@@ -987,7 +987,7 @@ def _list_outputs(self):
987987 else :
988988 if self .inputs .sort_filelist :
989989 outfiles = human_order_sorted (outfiles )
990- outputs [key ].append (list_to_filename (outfiles ))
990+ outputs [key ].append (simplify_list (outfiles ))
991991 if any ([val is None for val in outputs [key ]]):
992992 outputs [key ] = []
993993 if len (outputs [key ]) == 0 :
@@ -1195,7 +1195,7 @@ def _list_outputs(self):
11951195 else :
11961196 if self .inputs .sort_filelist :
11971197 filelist = human_order_sorted (filelist )
1198- outputs [key ] = list_to_filename (filelist )
1198+ outputs [key ] = simplify_list (filelist )
11991199 for argnum , arglist in enumerate (args ):
12001200 maxlen = 1
12011201 for arg in arglist :
@@ -1241,7 +1241,7 @@ def _list_outputs(self):
12411241 else :
12421242 if self .inputs .sort_filelist :
12431243 outfiles = human_order_sorted (outfiles )
1244- outputs [key ].append (list_to_filename (outfiles ))
1244+ outputs [key ].append (simplify_list (outfiles ))
12451245 if self .inputs .drop_blank_outputs :
12461246 outputs [key ] = [x for x in outputs [key ] if x is not None ]
12471247 else :
@@ -1409,7 +1409,7 @@ def _list_outputs(self):
14091409
14101410 # Handle whether this must be a list or not
14111411 if field not in force_lists :
1412- filelist = list_to_filename (filelist )
1412+ filelist = simplify_list (filelist )
14131413
14141414 outputs [field ] = filelist
14151415
@@ -1750,7 +1750,7 @@ def _get_files(self, path, key, dirval, altkey=None):
17501750 globprefix = self .inputs .hemi + '.'
17511751 else :
17521752 globprefix = '*'
1753- keys = filename_to_list (altkey ) if altkey else [key ]
1753+ keys = ensure_list (altkey ) if altkey else [key ]
17541754 globfmt = os .path .join (path , dirval , '' .join ((globprefix , '{}' ,
17551755 globsuffix )))
17561756 return [
@@ -1768,7 +1768,7 @@ def _list_outputs(self):
17681768 output_traits .traits ()[k ].loc ,
17691769 output_traits .traits ()[k ].altkey )
17701770 if val :
1771- outputs [k ] = list_to_filename (val )
1771+ outputs [k ] = simplify_list (val )
17721772 return outputs
17731773
17741774
@@ -1909,7 +1909,7 @@ def _list_outputs(self):
19091909 file_objects = xnat .select (template ).get ('obj' )
19101910 if file_objects == []:
19111911 raise IOError ('Template %s returned no files' % template )
1912- outputs [key ] = list_to_filename ([
1912+ outputs [key ] = simplify_list ([
19131913 str (file_object .get ()) for file_object in file_objects
19141914 if file_object .exists ()
19151915 ])
@@ -1944,7 +1944,7 @@ def _list_outputs(self):
19441944 raise IOError ('Template %s '
19451945 'returned no files' % target )
19461946
1947- outfiles = list_to_filename ([
1947+ outfiles = simplify_list ([
19481948 str (file_object .get ())
19491949 for file_object in file_objects
19501950 if file_object .exists ()
@@ -1956,7 +1956,7 @@ def _list_outputs(self):
19561956 raise IOError ('Template %s '
19571957 'returned no files' % template )
19581958
1959- outfiles = list_to_filename ([
1959+ outfiles = simplify_list ([
19601960 str (file_object .get ())
19611961 for file_object in file_objects
19621962 if file_object .exists ()
@@ -2079,7 +2079,7 @@ def _list_outputs(self):
20792079 # gather outputs and upload them
20802080 for key , files in list (self .inputs ._outputs .items ()):
20812081
2082- for name in filename_to_list (files ):
2082+ for name in ensure_list (files ):
20832083
20842084 if isinstance (name , list ):
20852085 for i , file_name in enumerate (name ):
@@ -2205,7 +2205,7 @@ def __init__(self, input_names, **inputs):
22052205
22062206 super (SQLiteSink , self ).__init__ (** inputs )
22072207
2208- self ._input_names = filename_to_list (input_names )
2208+ self ._input_names = ensure_list (input_names )
22092209 add_traits (self .inputs , [name for name in self ._input_names ])
22102210
22112211 def _list_outputs (self ):
@@ -2263,7 +2263,7 @@ def __init__(self, input_names, **inputs):
22632263
22642264 super (MySQLSink , self ).__init__ (** inputs )
22652265
2266- self ._input_names = filename_to_list (input_names )
2266+ self ._input_names = ensure_list (input_names )
22672267 add_traits (self .inputs , [name for name in self ._input_names ])
22682268
22692269 def _list_outputs (self ):
@@ -2463,7 +2463,7 @@ def _get_files_over_ssh(self, template):
24632463 iflogger .info ('remote file %s not found' % f )
24642464
24652465 # return value
2466- outfiles = list_to_filename (outfiles )
2466+ outfiles = simplify_list (outfiles )
24672467
24682468 return outfiles
24692469
0 commit comments