mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-04-15 18:11:48 +04:00
Moving from aspy.yaml to ruamel.yaml in order to preserve comments when using autoupdate - fixes #210
This commit is contained in:
parent
bbf1f62ed6
commit
ebaf7da989
6 changed files with 35 additions and 19 deletions
11
pre_commit/yaml.py
Executable file
11
pre_commit/yaml.py
Executable 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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue