Toml Writer
This ConfigWriter adds Toml export and import support.
Module
- class comprehensiveconfig.toml.TomlWriter
- classmethod dumps(cls, node) str
- Parameters:
node (AnyConfigField) – The configuration object we are writing.
Dumps a string output from a given config
- classmethod dump(cls, file, node) str
- Parameters:
file – The file name or object we are writing to.
node (AnyConfigField) – The configuration object we are writing.
Dumps a to a configuration section to a given file
- classmethod loads(cls, data: str)
- Parameters:
data (str) – The configuration object we are writing.
Load the given configuration string as
- classmethod load(cls, file)
- Parameters:
file – The file name or object we are writing to.
Load a given file and create a configuration object
Private Methods
- classmethod dump_section(cls, node) list
- Parameters:
node – The
comprehensiveconfig.spec.Sectioninstance being dumped
Dumps a section to a list of lines to write
- classmethod format_value(cls, value) str
- Parameters:
value – The object we are formatting into valid toml.
Dump a value or node into the appropriate formatting for toml.
- classmethod dump_field(cls, node: spec.AnyConfigField, original_name: str, field_name: str, value) str
- Parameters:
node (AnyConfigField) – The parent node containing this field
original_name (str) – Name of the python class attribute attributed to the field
field_name (str) – The true field name being used (this could be mutated)
value – The value of this field
Dump a field into valid toml