ruamel.yaml
formats a simple, but nested dictionary differently depending on if it's using the safe
or the round-trip
representer.
I can't see why the different repersenters should format such a simple dictionary differently, so I'm wondering how to get the safe
representer to look similar to the round-trip
one in the following example:
from ruamel.yaml import YAML
import sys
data = {'data': {'interval': 5, 'compression': '3'}, 'player': {'ffmpeg': {'name': 'me'}}}
yaml = YAML(typ='safe')
yaml.dump(data, sys.stdout)
This prints
data: {compression: '3', interval: 5}
player:
ffmpeg: {name: me}
But
yaml = YAML()
yaml.dump(data, sys.stdout)
prints a much nicer output:
data:
interval: 5
compression: '3'
player:
ffmpeg:
name: me
How can I get the safe
version to print similarity?