Skip to content

Instantly share code, notes, and snippets.

@paulera
Created March 12, 2019 01:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save paulera/9ae4261f0c205feb942b58fb961a3178 to your computer and use it in GitHub Desktop.
Save paulera/9ae4261f0c205feb942b58fb961a3178 to your computer and use it in GitHub Desktop.
Make PyYAML stop converting yes/no to true/false
# 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