preserve_quotes not taken into account
ruamel.yaml is a YAML 1.2 parser/emitter for Python
Brought to you by:
anthon
In YAML class, method get_constructor_parser, the preserve_quotes parameter is not passed.
class XLoader(self.Parser, self.Constructor, rslvr): # type: ignore
def __init__(selfx, stream, version=self.version, preserve_quotes=None):
# type: (StreamTextType, Optional[VersionType], Optional[bool]) -> None # NOQA
CParser.__init__(selfx, stream)
selfx._parser = selfx._composer = selfx
self.Constructor.__init__(selfx, loader=selfx)
selfx.allow_duplicate_keys = self.allow_duplicate_keys
rslvr.__init__(selfx, version=version, loadumper=selfx)
self._stream = stream
loader = XLoader(stream)
I have resolved like this:
self.Constructor.__init__(selfx, loader=selfx, preserve_quotes=preserve_quotes)
...
loader = XLoader(stream, preserve_quotes=self.preserve_quotes)
The preserve_quotes parameter pre-dates the new API so it had to be added as an argument to all constructors. But only the RoundTripConstructor uses it, and that is not created if you go through
get_constructor_parser.Without actual failing code that calls this , I fail to see what problem this solves.