yaml_include.representer module

yaml_include.representer module#

class yaml_include.representer.Representer(tag)[source]#

Bases: object

Representer for Data

When dumping an object into a YAML string, this representer serializes Data instances within the object.

To add the representer to the PyYAML Dumper class, use the following code:

import yaml_include

rpr = yaml_include.Representer("inc")  # Note: No "!" prefix needed
yaml.add_representer(Data, rpr)
Parameters:

tag (str)

tag: str#

YAML tag name for include statement (without the “!” prefix)

The “!” prefix is automatically added by yaml.add_representer().

Example

>>> rpr = yaml_include.Representer("inc")  # Creates "!inc" tag