Created
March 12, 2019 01:43
-
-
Save paulera/9ae4261f0c205feb942b58fb961a3178 to your computer and use it in GitHub Desktop.
Make PyYAML stop converting yes/no to true/false
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
# ref: https://stackoverflow.com/questions/36463531/pyyaml-automatically-converting-certain-keys-to-boolean-values | |
from yaml.constructor import Constructor | |
def add_bool(self, node): | |
return self.construct_scalar(node) | |
Constructor.add_constructor(u'tag:yaml.org,2002:bool', add_bool) | |
# code continues here ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment