33
33
34
34
from .. import config , logging
35
35
from ..utils .filemanip import (
36
- copyfile , list_to_filename , filename_to_list ,
36
+ copyfile , simplify_list , ensure_list ,
37
37
get_related_files , related_filetype_sets )
38
38
from ..utils .misc import human_order_sorted , str2bool
39
39
from .base import (
@@ -721,7 +721,7 @@ def _list_outputs(self):
721
721
if not isdefined (files ):
722
722
continue
723
723
iflogger .debug ("key: %s files: %s" , key , str (files ))
724
- files = filename_to_list (files )
724
+ files = ensure_list (files )
725
725
tempoutdir = outdir
726
726
if s3_flag :
727
727
s3tempoutdir = s3dir
@@ -738,7 +738,7 @@ def _list_outputs(self):
738
738
files = [item for sublist in files for item in sublist ]
739
739
740
740
# Iterate through passed-in source files
741
- for src in filename_to_list (files ):
741
+ for src in ensure_list (files ):
742
742
# Format src and dst files
743
743
src = os .path .abspath (src )
744
744
if not os .path .isfile (src ):
@@ -938,7 +938,7 @@ def _list_outputs(self):
938
938
else :
939
939
if self .inputs .sort_filelist :
940
940
filelist = human_order_sorted (filelist )
941
- outputs [key ] = list_to_filename (filelist )
941
+ outputs [key ] = simplify_list (filelist )
942
942
for argnum , arglist in enumerate (args ):
943
943
maxlen = 1
944
944
for arg in arglist :
@@ -987,7 +987,7 @@ def _list_outputs(self):
987
987
else :
988
988
if self .inputs .sort_filelist :
989
989
outfiles = human_order_sorted (outfiles )
990
- outputs [key ].append (list_to_filename (outfiles ))
990
+ outputs [key ].append (simplify_list (outfiles ))
991
991
if any ([val is None for val in outputs [key ]]):
992
992
outputs [key ] = []
993
993
if len (outputs [key ]) == 0 :
@@ -1195,7 +1195,7 @@ def _list_outputs(self):
1195
1195
else :
1196
1196
if self .inputs .sort_filelist :
1197
1197
filelist = human_order_sorted (filelist )
1198
- outputs [key ] = list_to_filename (filelist )
1198
+ outputs [key ] = simplify_list (filelist )
1199
1199
for argnum , arglist in enumerate (args ):
1200
1200
maxlen = 1
1201
1201
for arg in arglist :
@@ -1241,7 +1241,7 @@ def _list_outputs(self):
1241
1241
else :
1242
1242
if self .inputs .sort_filelist :
1243
1243
outfiles = human_order_sorted (outfiles )
1244
- outputs [key ].append (list_to_filename (outfiles ))
1244
+ outputs [key ].append (simplify_list (outfiles ))
1245
1245
if self .inputs .drop_blank_outputs :
1246
1246
outputs [key ] = [x for x in outputs [key ] if x is not None ]
1247
1247
else :
@@ -1409,7 +1409,7 @@ def _list_outputs(self):
1409
1409
1410
1410
# Handle whether this must be a list or not
1411
1411
if field not in force_lists :
1412
- filelist = list_to_filename (filelist )
1412
+ filelist = simplify_list (filelist )
1413
1413
1414
1414
outputs [field ] = filelist
1415
1415
@@ -1750,7 +1750,7 @@ def _get_files(self, path, key, dirval, altkey=None):
1750
1750
globprefix = self .inputs .hemi + '.'
1751
1751
else :
1752
1752
globprefix = '*'
1753
- keys = filename_to_list (altkey ) if altkey else [key ]
1753
+ keys = ensure_list (altkey ) if altkey else [key ]
1754
1754
globfmt = os .path .join (path , dirval , '' .join ((globprefix , '{}' ,
1755
1755
globsuffix )))
1756
1756
return [
@@ -1768,7 +1768,7 @@ def _list_outputs(self):
1768
1768
output_traits .traits ()[k ].loc ,
1769
1769
output_traits .traits ()[k ].altkey )
1770
1770
if val :
1771
- outputs [k ] = list_to_filename (val )
1771
+ outputs [k ] = simplify_list (val )
1772
1772
return outputs
1773
1773
1774
1774
@@ -1909,7 +1909,7 @@ def _list_outputs(self):
1909
1909
file_objects = xnat .select (template ).get ('obj' )
1910
1910
if file_objects == []:
1911
1911
raise IOError ('Template %s returned no files' % template )
1912
- outputs [key ] = list_to_filename ([
1912
+ outputs [key ] = simplify_list ([
1913
1913
str (file_object .get ()) for file_object in file_objects
1914
1914
if file_object .exists ()
1915
1915
])
@@ -1944,7 +1944,7 @@ def _list_outputs(self):
1944
1944
raise IOError ('Template %s '
1945
1945
'returned no files' % target )
1946
1946
1947
- outfiles = list_to_filename ([
1947
+ outfiles = simplify_list ([
1948
1948
str (file_object .get ())
1949
1949
for file_object in file_objects
1950
1950
if file_object .exists ()
@@ -1956,7 +1956,7 @@ def _list_outputs(self):
1956
1956
raise IOError ('Template %s '
1957
1957
'returned no files' % template )
1958
1958
1959
- outfiles = list_to_filename ([
1959
+ outfiles = simplify_list ([
1960
1960
str (file_object .get ())
1961
1961
for file_object in file_objects
1962
1962
if file_object .exists ()
@@ -2079,7 +2079,7 @@ def _list_outputs(self):
2079
2079
# gather outputs and upload them
2080
2080
for key , files in list (self .inputs ._outputs .items ()):
2081
2081
2082
- for name in filename_to_list (files ):
2082
+ for name in ensure_list (files ):
2083
2083
2084
2084
if isinstance (name , list ):
2085
2085
for i , file_name in enumerate (name ):
@@ -2205,7 +2205,7 @@ def __init__(self, input_names, **inputs):
2205
2205
2206
2206
super (SQLiteSink , self ).__init__ (** inputs )
2207
2207
2208
- self ._input_names = filename_to_list (input_names )
2208
+ self ._input_names = ensure_list (input_names )
2209
2209
add_traits (self .inputs , [name for name in self ._input_names ])
2210
2210
2211
2211
def _list_outputs (self ):
@@ -2263,7 +2263,7 @@ def __init__(self, input_names, **inputs):
2263
2263
2264
2264
super (MySQLSink , self ).__init__ (** inputs )
2265
2265
2266
- self ._input_names = filename_to_list (input_names )
2266
+ self ._input_names = ensure_list (input_names )
2267
2267
add_traits (self .inputs , [name for name in self ._input_names ])
2268
2268
2269
2269
def _list_outputs (self ):
@@ -2463,7 +2463,7 @@ def _get_files_over_ssh(self, template):
2463
2463
iflogger .info ('remote file %s not found' % f )
2464
2464
2465
2465
# return value
2466
- outfiles = list_to_filename (outfiles )
2466
+ outfiles = simplify_list (outfiles )
2467
2467
2468
2468
return outfiles
2469
2469
0 commit comments