def get_file_dict(filename_list, log_printer):
 file_dict = {}
 for filename in filename_list:
  try:
   with open(filename, 'r', encoding='utf-8') as _file:
    file_dict[filename] = tuple(_file.readlines())
  except UnicodeDecodeError:
   log_printer.warn("Failed to read file '{}'. It seems to contain non-unicode characters. Leaving it out.".format(filename))
  except OSError as exception:
   log_printer.log_exception("Failed to read file '{}' because of an unknown error. Leaving it out.".format(filename), exception, log_level=LOG_LEVEL.WARNING)
 log_printer.debug(('Files that will be checked:\n' + '\n'.join(file_dict.keys())))
 return file_dict

def get_file_dict ( filename_list , log_printer ) : file_dict = { } for filename in filename_list : try : with open ( filename , 'r' , encoding = 'utf-8' ) as _file : file_dict [ filename ] = tuple ( _file . readlines ( ) ) except UnicodeDecodeError : log_printer . warn ( "Failed to read file '{}'. It seems to contain non-unicode characters. Leaving it out." . format ( filename ) ) except OSError as exception : log_printer . log_exception ( "Failed to read file '{}' because of an unknown error. Leaving it out." . format ( filename ) , exception , log_level = LOG_LEVEL . WARNING ) log_printer . debug ( ( 'Files that will be checked:\n' + '\n' . join ( file_dict . keys ( ) ) ) ) return file_dict
reads all files into a dictionary .