def load_yaml(fname: str) -> Union[List, Dict]:
"""Load a YAML file."""
try:
with open(fname, encoding='utf-8') as conf_file:
# If configuration file is empty YAML returns None
# We convert that to an empty dict
return yaml.load(conf_file, Loader=SafeLineLoader) or {}
except yaml.YAMLError as exc:
logger.error(exc)
raise ScarlettError(exc)
except UnicodeDecodeError as exc:
logger.error('Unable to read file %s: %s', fname, exc)
raise ScarlettError(exc)
# def clear_secret_cache() -> None:
# """Clear the secret cache.
#
# Async friendly.
# """
# __SECRET_CACHE.clear()
评论列表
文章目录