@verbose
def _ensure_src(src, kind=None, verbose=None):
 if isinstance(src, string_types):
  if (not op.isfile(src)):
   raise IOError(('Source space file "%s" not found' % src))
  logger.info(('Reading %s...' % src))
  src = read_source_spaces(src, verbose=False)
 if (not isinstance(src, SourceSpaces)):
  raise ValueError('src must be a string or instance of SourceSpaces')
 if (kind is not None):
  if (kind == 'surf'):
   surf = [s for s in src if (s['type'] == 'surf')]
   if ((len(surf) != 2) or (len(src) != 2)):
    raise ValueError('Source space must contain exactly two surfaces.')
   src = surf
 return src

@ verbose def _ensure_src ( src , kind = None , verbose = None ) : if isinstance ( src , string_types ) : if ( not op . isfile ( src ) ) : raise IOError ( ( 'Source space file "%s" not found' % src ) ) logger . info ( ( 'Reading %s...' % src ) ) src = read_source_spaces ( src , verbose = False ) if ( not isinstance ( src , SourceSpaces ) ) : raise ValueError ( 'src must be a string or instance of SourceSpaces' ) if ( kind is not None ) : if ( kind == 'surf' ) : surf = [ s for s in src if ( s [ 'type' ] == 'surf' ) ] if ( ( len ( surf ) != 2 ) or ( len ( src ) != 2 ) ) : raise ValueError ( 'Source space must contain exactly two surfaces.' ) src = surf return src
ensure we have a source space .