Moving from aspy.yaml to ruamel.yaml in order to preserve comments when using autoupdate - fixes #210

This commit is contained in:
Cimon Lucas (LCM) 2016-09-28 10:51:32 +02:00
parent bbf1f62ed6
commit ebaf7da989
6 changed files with 35 additions and 19 deletions

11
pre_commit/yaml.py Executable file
View file

@ -0,0 +1,11 @@
from ruamel import yaml
def yaml_dump(obj, **kwargs):
"Ensure order & comments preservation"
return yaml.dump(obj, Dumper=yaml.RoundTripDumper, **kwargs)
def yaml_load(content):
"Ensure order & comments preservation"
return yaml.load(content, Loader=yaml.RoundTripLoader)