@@ -242,8 +242,7 @@ class ImageFile(File):
242242 """ Defines a trait of specific neuroimaging files """
243243
244244 def __init__ (self , value = '' , filter = None , auto_set = False , entries = 0 ,
245- exists = False , types = [], allow_compressed = True , extensions = [],
246- ** metadata ):
245+ exists = False , types = [], allow_compressed = True , ** metadata ):
247246 """ Trait handles neuroimaging files.
248247
249248 Parameters
@@ -255,12 +254,12 @@ def __init__(self, value='', filter=None, auto_set=False, entries=0,
255254 """
256255 self .types = types
257256 self .allow_compressed = allow_compressed
258- self .exts = extensions
259257 super (ImageFile , self ).__init__ (value , filter , auto_set , entries ,
260258 exists , ** metadata )
261259
262- def grab_exts (self , exts = [] ):
260+ def grab_exts (self ):
263261 # TODO: file type validation
262+ exts = []
264263 for fmt in self .types :
265264 if fmt in img_fmt_types :
266265 exts .extend (sum ([[u for u in y [0 ]] if isinstance (y [0 ], tuple )
@@ -271,7 +270,7 @@ def grab_exts(self, exts=[]):
271270 else :
272271 raise AttributeError ('Information has not been added for format'
273272 ' type {} yet. Supported formats include: '
274- '{}' .format ('hello' ,
273+ '{}' .format (fmt ,
275274 ', ' .join (img_fmt_types .keys ())))
276275 return list (set (exts ))
277276
@@ -280,11 +279,11 @@ def validate(self, object, name, value):
280279 """
281280 validated_value = super (ImageFile , self ).validate (object , name , value )
282281 if validated_value and self .types :
283- self .exts = self .grab_exts (self . exts )
284- if not any (validated_value .endswith (x ) for x in self .exts ):
282+ self ._exts = self .grab_exts ()
283+ if not any (validated_value .endswith (x ) for x in self ._exts ):
285284 raise TraitError (
286285 args = "{} is not included in allowed types: {}" .format (
287- validated_value , ',' .join (self .exts )))
286+ validated_value , ', ' .join (self ._exts )))
288287 return validated_value
289288
290289"""
0 commit comments