Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

switch from pyyaml to ruamel.yaml #351

Merged
merged 1 commit into from
Dec 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions pre_commit_hooks/check_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,9 @@
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):
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
packages=find_packages(exclude=('tests*', 'testing*')),
install_requires=[
'flake8',
'pyyaml',
'ruamel.yaml>=0.15',
'six',
],
entry_points={
Expand Down