class_docstr: Defines a trait whose value must be a file path.
  
  >>> from nipype.interfaces.base import File, TraitedSpec, TraitError
  >>> class A(TraitedSpec):
  ...     foo = File()
  >>> a = A()
  >>> a.foo
  <undefined>
  
  >>> a.foo = '/some/made/out/path/to/file'
  >>> a.foo
  '/some/made/out/path/to/file'
  
  >>> class A(TraitedSpec):
  ...     foo = File(exists=False, resolve=True)
  >>> a = A(foo='idontexist.txt')
  >>> a.foo  # doctest: +ELLIPSIS
  '.../idontexist.txt'
  
  >>> class A(TraitedSpec):
  ...     foo = File(exists=True, resolve=True)
  >>> a = A()
  >>> a.foo = 'idontexist.txt'  # doctest: +IGNORE_EXCEPTION_DETAIL
  Traceback (most recent call last):
  TraitError:
  
  >>> open('idoexist.txt', 'w').close()
  >>> a.foo = 'idoexist.txt'
  >>> a.foo  # doctest: +ELLIPSIS
  '.../idoexist.txt'
  
  >>> class A(TraitedSpec):
  ...     foo = File('idoexist.txt')
  >>> a = A()
  >>> a.foo
  <undefined>
  
  >>> class A(TraitedSpec):
  ...     foo = File('idoexist.txt', usedefault=True)
  >>> a = A()
  >>> a.foo
  'idoexist.txt'
  
  >>> class A(TraitedSpec):
  ...     foo = File(exists=True, resolve=True, extensions=['.txt', 'txt.gz'])
  >>> a = A()
  >>> a.foo = 'idoexist.badtxt'  # doctest: +IGNORE_EXCEPTION_DETAIL
  Traceback (most recent call last):
  TraitError:
  
  >>> a.foo = 'idoexist.txt'
  >>> a.foo  # doctest: +ELLIPSIS
  '.../idoexist.txt'
  
  >>> class A(TraitedSpec):
  ...     foo = File(extensions=['.nii', '.nii.gz'])
  >>> a = A()
  >>> a.foo = 'badext.txt'  # doctest: +IGNORE_EXCEPTION_DETAIL
  Traceback (most recent call last):
  TraitError:
  
  >>> class A(TraitedSpec):
  ...     foo = File(extensions=['.nii', '.nii.gz'])
  >>> a = A()
  >>> a.foo = 'goodext.nii'
  >>> a.foo
  'goodext.nii'
  
  >>> a = A()
  >>> a.foo = 'idontexist.000.nii'
  >>> a.foo  # doctest: +ELLIPSIS
  'idontexist.000.nii'
  
  >>> a = A()
  >>> a.foo = 'idontexist.000.nii.gz'
  >>> a.foo  # doctest: +ELLIPSIS
  'idontexist.000.nii.gz'
class_docstr_tok: ["Defines","a","trait","whose","value","must","be","a","file","path",".",">",">",">","from","nipype.interfaces.base","import","File",",","TraitedSpec",",","TraitError",">",">",">","class","A","(","TraitedSpec",")",":","...","foo","=","File","(",")",">",">",">","a","=","A","(",")",">",">",">","a.foo","<","undefined",">",">",">",">","a.foo","=","'\/some\/made\/out\/path\/to\/file'",">",">",">","a.foo","'\/some\/made\/out\/path\/to\/file'",">",">",">","class","A","(","TraitedSpec",")",":","...","foo","=","File","(","exists=False",",","resolve=True",")",">",">",">","a","=","A","(","foo='idontexist.txt","'",")",">",">",">","a.foo","#","doctest",":","+ELLIPSIS","'","...","\/idontexist.txt'",">",">",">","class","A","(","TraitedSpec",")",":","...","foo","=","File","(","exists=True",",","resolve=True",")",">",">",">","a","=","A","(",")",">",">",">","a.foo","=","'idontexist.txt","'","#","doctest",":","+IGNORE_EXCEPTION_DETAIL","Traceback","(","most","recent","call","last",")",":","TraitError",":",">",">",">","open","(","'idoexist.txt","'",",","'","w","'",")",".close","(",")",">",">",">","a.foo","=","'idoexist.txt'",">",">",">","a.foo","#","doctest",":","+ELLIPSIS","'","...","\/idoexist.txt'",">",">",">","class","A","(","TraitedSpec",")",":","...","foo","=","File","(","'idoexist.txt","'",")",">",">",">","a","=","A","(",")",">",">",">","a.foo","<","undefined",">",">",">",">","class","A","(","TraitedSpec",")",":","...","foo","=","File","(","'idoexist.txt","'",",","usedefault=True",")",">",">",">","a","=","A","(",")",">",">",">","a.foo","'idoexist.txt'",">",">",">","class","A","(","TraitedSpec",")",":","...","foo","=","File","(","exists=True",",","resolve=True",",","extensions=","[","'.txt","'",",","'txt.gz","'","]",")",">",">",">","a","=","A","(",")",">",">",">","a.foo","=","'idoexist.badtxt","'","#","doctest",":","+IGNORE_EXCEPTION_DETAIL","Traceback","(","most","recent","call","last",")",":","TraitError",":",">",">",">","a.foo","=","'idoexist.txt'",">",">",">","a.foo","#","doctest",":","+ELLIPSIS","'","...","\/idoexist.txt'",">",">",">","class","A","(","TraitedSpec",")",":","...","foo","=","File","(","extensions=","[","'.nii","'",",","'.nii.gz","'","]",")",">",">",">","a","=","A","(",")",">",">",">","a.foo","=","'badext.txt","'","#","doctest",":","+IGNORE_EXCEPTION_DETAIL","Traceback","(","most","recent","call","last",")",":","TraitError",":",">",">",">","class","A","(","TraitedSpec",")",":","...","foo","=","File","(","extensions=","[","'.nii","'",",","'.nii.gz","'","]",")",">",">",">","a","=","A","(",")",">",">",">","a.foo","=","'goodext.nii'",">",">",">","a.foo","'goodext.nii'",">",">",">","a","=","A","(",")",">",">",">","a.foo","=","'idontexist.000.nii'",">",">",">","a.foo","#","doctest",":","+ELLIPSIS","'idontexist.000.nii'",">",">",">","a","=","A","(",")",">",">",">","a.foo","=","'idontexist.000.nii.gz'",">",">",">","a.foo","#","doctest",":","+ELLIPSIS","'idontexist.000.nii.gz","'"]
docstr: Validate a value change.
docstr_tok: ["Validate","a","value","change","."]
code: def validate(self, objekt, name, value, return_pathlike=False):
      """Validate a value change."""
      value = super().validate(
          objekt, name, value, return_pathlike=True
      )
      if self._exts:
          fname = value.name
          if not any(fname.endswith(e) for e in self._exts):
              self.error(objekt, name, str(value))
  
      if not return_pathlike:
          value = str(value)
  
      return value
  
imports: from collections.abc import Sequence
  from traits import __version__
  import traits.api
  from traits.api import TraitType, Unicode
  from traits.trait_base import _Undefined
  from pathlib import Path
  from ...utils.filemanip import path_resolve
label_desc: Use image node_id 2 for calling the File obj's underlying member method code with example usage: obj.validate(objekt, name, value, return_pathlike) and returns: value