configblock.templatebuilder module

Helper class to build a template configuration file

class configblock.templatebuilder.TemplateBuilder(extra: Dict[Path | str, str | None], only_active: bool = False, default='REQUIRED', convert_values: bool = True)

Bases: DictWriter

Create a template configuration dictionary from a configblock

Creates a dictionary with all the options set to their default values for a user to edit.

begin_block() bool

Begin writing the specified block

Returns:

Whether the block should be entered

Return type:

bool

begin_subcfg(key: str, subcfg: ConfigBlock) bool

Begin writing a single subconfig

Note that this method should not handle further iteration into the subconfig

Returns:

Whether the subconfig should be entered

Return type:

bool

visit_option(key: str, option: OptionData) None

Visit a single option