switch from pyyaml to ruamel.yaml

This commit is contained in:
Anthony Sottile 2018-12-28 13:09:17 -08:00
parent c8bad492e1
commit a762639038
2 changed files with 6 additions and 8 deletions

View file

@ -4,12 +4,9 @@ import argparse
import collections
import sys
import yaml
import ruamel.yaml
try:
from yaml.cyaml import CSafeLoader as Loader
except ImportError: # pragma: no cover (no libyaml-dev / pypy)
Loader = yaml.SafeLoader
yaml = ruamel.yaml.YAML(typ='safe')
def _exhaust(gen):
@ -57,8 +54,9 @@ def check_yaml(argv=None):
retval = 0
for filename in args.filenames:
try:
load_fn(open(filename), Loader=Loader)
except yaml.YAMLError as exc:
with open(filename) as f:
load_fn(f)
except ruamel.yaml.YAMLError as exc:
print(exc)
retval = 1
return retval

View file

@ -25,7 +25,7 @@ setup(
packages=find_packages(exclude=('tests*', 'testing*')),
install_requires=[
'flake8',
'pyyaml',
'ruamel.yaml>=0.15',
'six',
],
entry_points={