def _write_config(filename, cfg, roundtrip=False):
try:
with open(filename, 'w') as f:
if roundtrip:
f.write(yaml.round_trip_dump(dict(cfg), indent=4))
else:
f.write(yaml.dump(cfg, indent=4))
except Exception as ex:
raise ConfigWriteError(filename, errors=[ex])
return cfg
评论列表
文章目录