Merge pull request #45 from salt-formulas/bump-version-1.5.3
Bump version to 1.5.3
diff --git a/reclass/output/yaml_outputter.py b/reclass/output/yaml_outputter.py
index 9a0d098..ef62979 100644
--- a/reclass/output/yaml_outputter.py
+++ b/reclass/output/yaml_outputter.py
@@ -9,15 +9,17 @@
from reclass.output import OutputterBase
import yaml
+_SafeDumper = yaml.CSafeDumper if yaml.__with_libyaml__ else yaml.SafeDumper
+
class Outputter(OutputterBase):
def dump(self, data, pretty_print=False, no_refs=False):
if (no_refs):
return yaml.dump(data, default_flow_style=not pretty_print, Dumper=ExplicitDumper)
else:
- return yaml.dump(data, default_flow_style=not pretty_print)
+ return yaml.dump(data, default_flow_style=not pretty_print, Dumper=_SafeDumper)
-class ExplicitDumper(yaml.SafeDumper):
+class ExplicitDumper(_SafeDumper):
"""
A dumper that will never emit aliases.
"""
diff --git a/reclass/storage/yamldata.py b/reclass/storage/yamldata.py
index ac3dcb9..b11312e 100644
--- a/reclass/storage/yamldata.py
+++ b/reclass/storage/yamldata.py
@@ -11,6 +11,8 @@
import os
from reclass.errors import NotFoundError
+_SafeLoader = yaml.CSafeLoader if yaml.__with_libyaml__ else yaml.SafeLoader
+
class YamlData(object):
@classmethod
@@ -23,7 +25,7 @@
raise NotFoundError('Cannot open: %s' % abs_path)
y = cls('yaml_fs://{0}'.format(abs_path))
with open(abs_path) as fp:
- data = yaml.safe_load(fp)
+ data = yaml.load(fp, Loader=_SafeLoader)
if data is not None:
y._data = data
return y
@@ -32,7 +34,7 @@
def from_string(cls, string, uri):
''' Initialise yaml data from a string '''
y = cls(uri)
- data = yaml.safe_load(string)
+ data = yaml.load(string, Loader=_SafeLoader)
if data is not None:
y._data = data
return y