-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow to safe_dump with OrderedDict instances #5
Conversation
@@ -18,6 +18,7 @@ def map_constructor(loader, node): | |||
|
|||
pyyaml.add_representer(dict, map_representer) | |||
pyyaml.add_representer(OrderedDict, map_representer) | |||
pyyaml.add_representer(OrderedDict, map_representer, Dumper=pyyaml.dumper.SafeDumper) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting, why are both of the above lines needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pyyaml.add_representer
works on the Dumper
class obj passed into it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, but if I remove line 20 everything still works for me. Do you have a test that fails when that line is removed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really? That's odd. For me, the existing test_dump
and test_dump_all
fail without line 20. Could you send me your pip freeze.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, "works for me" is not "running the oyaml tests" :-) All good, if you have tests that prove it's needed, that's weird, but okay :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. I've released v0.3 to warehouse (the new PyPI).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git tags are a thing you know ;-)
resolves #4