Пытаюсь создать yaml
import sys
from ruamel.yaml import YAML
class Entry:
yaml_tag = '!<!entry>'
def __init__(self, value, style=None):
self.value = value
self.style = style
@classmethod
def to_yaml(cls, representer, node):
return representer.represent_mapping(cls.yaml_tag, node.value, node.style)
@classmethod
def from_yaml(cls, constructor, node):
return cls(node.value, node.style)
data = {
'steps': [
Entry({
'id': 'Entry-1',
'actions': [],
})
],
}
yaml = YAML(typ='rt')
yaml.register_class(Entry)
yaml.dump(data, sys.stdout)
Но в выводе вместо !<!entry>
получаю !%3C%21entry%3E
.
steps:
- !%3C%21entry%3E
id: Entry-1
actions: []