mirror of
https://github.com/pre-commit/pre-commit-hooks.git
synced 2026-03-29 10:16:52 +00:00
switch from pyyaml to ruamel.yaml
This commit is contained in:
parent
c8bad492e1
commit
a762639038
2 changed files with 6 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
2
setup.py
2
setup.py
|
|
@ -25,7 +25,7 @@ setup(
|
|||
packages=find_packages(exclude=('tests*', 'testing*')),
|
||||
install_requires=[
|
||||
'flake8',
|
||||
'pyyaml',
|
||||
'ruamel.yaml>=0.15',
|
||||
'six',
|
||||
],
|
||||
entry_points={
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue