summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Scheibel <scheibel1@llnl.gov>2019-10-23 14:24:14 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2019-10-23 14:24:14 -0700
commit685946b1f1d9195c4916abf547d8aba008dd7207 (patch)
treea2038a40a1e0104f06de50ff5637f97d7137a4fc /lib
parentb29eb4212e8d9077e0c01911c5448a5900210954 (diff)
downloadspack-685946b1f1d9195c4916abf547d8aba008dd7207.tar.gz
spack-685946b1f1d9195c4916abf547d8aba008dd7207.tar.bz2
spack-685946b1f1d9195c4916abf547d8aba008dd7207.tar.xz
spack-685946b1f1d9195c4916abf547d8aba008dd7207.zip
syaml.dump now allows representing all syaml_ objects (originally this was only available for syaml.dump_config) (#13403)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/util/spack_yaml.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/lib/spack/spack/util/spack_yaml.py b/lib/spack/spack/util/spack_yaml.py
index c4910be8bd..264d5414de 100644
--- a/lib/spack/spack/util/spack_yaml.py
+++ b/lib/spack/spack/util/spack_yaml.py
@@ -183,13 +183,6 @@ class OrderedLineDumper(RoundTripDumper):
return super(OrderedLineDumper, self).represent_str(data)
-# Make our special objects look like normal YAML ones.
-OrderedLineDumper.add_representer(syaml_dict, OrderedLineDumper.represent_dict)
-OrderedLineDumper.add_representer(syaml_list, OrderedLineDumper.represent_list)
-OrderedLineDumper.add_representer(syaml_str, OrderedLineDumper.represent_str)
-OrderedLineDumper.add_representer(syaml_int, OrderedLineDumper.represent_int)
-
-
class SafeDumper(RoundTripDumper):
def ignore_aliases(self, _data):
@@ -197,10 +190,12 @@ class SafeDumper(RoundTripDumper):
return True
-# Allow syaml_dict objects to be represented by ruamel.yaml.dump. With this,
-# syaml_dict allows a user to provide an ordered dictionary to yaml.dump when
-# the RoundTripDumper is used.
+# Make our special objects look like normal YAML ones.
RoundTripDumper.add_representer(syaml_dict, RoundTripDumper.represent_dict)
+RoundTripDumper.add_representer(syaml_list, RoundTripDumper.represent_list)
+RoundTripDumper.add_representer(syaml_int, RoundTripDumper.represent_int)
+RoundTripDumper.add_representer(syaml_str, RoundTripDumper.represent_str)
+OrderedLineDumper.add_representer(syaml_str, OrderedLineDumper.represent_str)
#: Max integer helps avoid passing too large a value to cyaml.