lisa.conf.KeyDescBase#
- class lisa.conf.KeyDescBase(name, help)[source]#
Bases:
ABC
Base class for configuration files key descriptor.
This allows defining the structure of the configuration file, in order to sanitize user input and generate help snippets used in various places.
Attributes
Help description associated with the key.
Name of that key.
Parent
LevelKeyDesc
.Properties
Path in the config file from the root to that key.
Qualified name of the configuration key used for error reporting.
Methods
Get a help message describing the key.
Validate a value to be used for that key.
Attributes#
- KeyDescBase.help#
Help description associated with the key.
- KeyDescBase.name#
Name of that key.
- KeyDescBase.parent#
Parent
LevelKeyDesc
.
Properties#
- property KeyDescBase.path[source]#
Path in the config file from the root to that key.
This path is a list of strings, one item per level.
Note
This includes the top-level key name, which must be removed before it’s fed to
MultiSrcConf.get_nested_key()
.
Methods#
- abstract KeyDescBase.get_help(style=None, last=False, children=True)[source]#
Get a help message describing the key.
- abstract KeyDescBase.validate_val(val)[source]#
Validate a value to be used for that key.
- Raises:
TypeError – When the value has the wrong type
ValueError – If the value does not comply with some other constraints. Note that constraints should ideally be encoded in the type itself, to make help message as straightforward as possible.