yaml_include.representer module

class yaml_include.representer.Representer(tag: str)[source]

Bases: object

Representer for Data

When dumping an object into YAML string, it deserializes Data instance(s) in it.

Add the representer to PyYAML Dumper class as below:

import yaml_include

rpr = yaml_include.Representer("inc")  # ATTENTION: No "!" here !!!
yaml.add_representer(Data, rpr)
Parameters:

tag (str)

tag: str

YAML tag name for include statement

Attention

Custom YAML tag’s name starts with "!". But we MUST NOT put a "!" at the beginning here, because yaml.add_representer() will add the symbol itself.