From 22920333188e444c84000a7e397c203e5c1c4c0f Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Tue, 19 Mar 2013 13:28:21 -0400 Subject: [PATCH] update our YAML dumper to use tildes for nulls, so our one tilde doesnt get changed on output from a script --- scripts/utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/utils.py b/scripts/utils.py index 55ee62683..6bb6e7429 100644 --- a/scripts/utils.py +++ b/scripts/utils.py @@ -196,6 +196,11 @@ def our_string_representer(dumper, value): return dumper.represent_scalar(u'tag:yaml.org,2002:str', value, style=style) Dumper.add_representer(str, our_string_representer) Dumper.add_representer(unicode, our_string_representer) + +# Add a representer for nulls too. YAML accepts "~" for None, but the +# default output converts that to "null". +Dumper.add_representer(type(None), lambda dumper, value : \ + dumper.represent_scalar(u'tag:yaml.org,2002:null', u"~")) # Apply some common settings for loading/dumping YAML and cache the # data in pickled format which is a LOT faster than YAML.