def parse_file(cls, path):
try:
if hasattr(path, 'read') and callable(path.read):
# File-like obj
conf = yaml.load(path.read(), Loader=_Loader)
else:
with io.open(path) as f:
conf = yaml.load(f.read(), Loader=_Loader)
except yaml.error.MarkedYAMLError as e:
raise InvalidSpecification(str(e))
return cls.parse(conf)
评论列表
文章目录