configblock.templatebuilder module

Helper class to build a template configuration file

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

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()

Begin writing the specified block

Returns

Whether the block should be entered

Return type

bool

begin_subcfg(key: str, subcfg: ConfigBlock)

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

write_option(key: str, option: OptionData)

Write a single option