There are a lot of questions on stack overflow about how to preserve quotes in YAML but there seem to be no questions that are asking how to merely change the default WHEN pyyaml/ruamel.yaml determine that quotes are needed.
I know that most strings don’t need quoting and I don’t want to quote those. But when it is needed, how do I change default quoting?
I don’t want to override style='"'
for str
because that will cause ALL strings to be quoted (including yaml keys, yuck) which is not what I want.
I thought it might be as simple as adding a str representer and checking the type of the incoming data and if SingleQuotedScalarString, then cast to DoubleQuotedScalarString but I always only receive <class 'str'>
so I guess it’s not as simple as that.