def import_files(lib, paths, query):
 for path in paths:
  if (not os.path.exists(syspath(normpath(path)))):
   raise ui.UserError(u'no such file or directory: {0}'.format(displayable_path(path)))
 if (config['import']['quiet'] and config['import']['timid']):
  raise ui.UserError(u"can't be both quiet and timid")
 if (config['import']['log'].get() is not None):
  logpath = syspath(config['import']['log'].as_filename())
  try:
   loghandler = logging.FileHandler(logpath)
  except IOError:
   raise ui.UserError(u'could not open log file for writing: {0}'.format(displayable_path(logpath)))
 else:
  loghandler = None
 if ((config['import']['resume'].get() == 'ask') and config['import']['quiet']):
  config['import']['resume'] = False
 session = TerminalImportSession(lib, loghandler, paths, query)
 session.run()
 plugins.send('import', lib=lib, paths=paths)

def import_files ( lib , paths , query ) : for path in paths : if ( not os . path . exists ( syspath ( normpath ( path ) ) ) ) : raise ui . UserError ( u'no such file or directory: {0}' . format ( displayable_path ( path ) ) ) if ( config [ 'import' ] [ 'quiet' ] and config [ 'import' ] [ 'timid' ] ) : raise ui . UserError ( u"can't be both quiet and timid" ) if ( config [ 'import' ] [ 'log' ] . get ( ) is not None ) : logpath = syspath ( config [ 'import' ] [ 'log' ] . as_filename ( ) ) try : loghandler = logging . FileHandler ( logpath ) except IOError : raise ui . UserError ( u'could not open log file for writing: {0}' . format ( displayable_path ( logpath ) ) ) else : loghandler = None if ( ( config [ 'import' ] [ 'resume' ] . get ( ) == 'ask' ) and config [ 'import' ] [ 'quiet' ] ) : config [ 'import' ] [ 'resume' ] = False session = TerminalImportSession ( lib , loghandler , paths , query ) session . run ( ) plugins . send ( 'import' , lib = lib , paths = paths )
import the files in the given list of paths or matching the query .