def load_from_resource(name):
  """
  Returns the contents of a file resource.

  If the resource exists in the users data directory, it is used instead
  of the default resource.

  """
  filepath = Path(USER_DIR) / name
  if filepath.exists():
    with filepath.open() as fh:
      return fh.read()
  else:
    return resource_string('wdiffhtml', 'data/' + name).decode('utf-8')
def load_from_resource ( name ) : filepath = Path ( USER_DIR ) / name if filepath . exists ( ) : with filepath . open ( ) as fh : return fh . read ( ) else : return resource_string ( 'wdiffhtml' , 'data/' + name ) . decode ( 'utf-8' )
Returns the contents of a file resource.

  If the resource exists in the users data directory, it is used instead
  of the default resource.