Created
May 9, 2017 12:34
-
-
Save schbrongx/3908a5d5c94884f5690db5cf28fcc830 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def setup_yaml(): | |
""" add a yaml representer which preservers the order when dumping an OrderedDict """ | |
representer_ordered_dict = lambda self, content: self.represent_mapping('tag:yaml.org,2002:map', content.items()) | |
yaml.add_representer(collections.OrderedDict, representer_ordered_dict) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment