summaryrefslogtreecommitdiffstats
path: root/func/yaml/redump.py
diff options
context:
space:
mode:
authorMichael DeHaan <mdehaan@redhat.com>2008-07-07 17:06:34 -0400
committerMichael DeHaan <mdehaan@redhat.com>2008-07-07 17:06:34 -0400
commitcda37e78dc61e8993e5868f3bbac173a69c5afd3 (patch)
tree56679db9fcfc1186753883676656ae1723e8dc63 /func/yaml/redump.py
parent1d774702a1972f7f50b77a07553e59eeaebf0781 (diff)
downloadfunc-cda37e78dc61e8993e5868f3bbac173a69c5afd3.tar.gz
func-cda37e78dc61e8993e5868f3bbac173a69c5afd3.tar.xz
func-cda37e78dc61e8993e5868f3bbac173a69c5afd3.zip
Including yaml parser for use by Func-transmit, as we want to make sure we have
one around that is compatible with older Python, and also tweaked not to do crayz things with stream layout.
Diffstat (limited to 'func/yaml/redump.py')
-rw-r--r--func/yaml/redump.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/func/yaml/redump.py b/func/yaml/redump.py
new file mode 100644
index 0000000..eefd68e
--- /dev/null
+++ b/func/yaml/redump.py
@@ -0,0 +1,22 @@
+"""
+pyyaml legacy
+Copyright (c) 2001 Steve Howell and Friends; All Rights Reserved
+(see open source license information in docs/ directory)
+"""
+
+from ordered_dict import OrderedDict
+from load import Parser
+from dump import Dumper
+from stream import StringStream
+
+def loadOrdered(stream):
+ parser = Parser(StringStream(stream))
+ parser.dictionary = OrderedDict
+ return iter(parser)
+
+def redump(stream):
+ docs = list(loadOrdered(stream))
+ dumper = Dumper()
+ dumper.alphaSort = 0
+ return dumper.dump(*docs)
+