lisa.conf.KeyDesc#
- class lisa.conf.KeyDesc(name, help, classinfo, newtype=None, deepcopy_val=True)[source]#
Bases:
KeyDescBase
Key descriptor describing a leaf key in the configuration.
- Parameters:
name – Name of the key
help – Short help message describing the use of that key
classinfo (collections.abc.Sequence) – sequence of allowed types for that key. As a special case, None is allowed in that sequence of types, even though it is not strictly speaking a type.
newtype (str or None) – If specified, a type with the given name will be created for that key with that name. Otherwise, a camel-case name derived from the key name will be used:
toplevel-key/sublevel/mykey
will give a type named SublevelMykey. This class will be exposed as an attribute of the parentMultiSrcConf
(which is why the toplevel key is omitted from its name). A getter will also be created on the parent configuration class, so that the typed key is exposed toexekall
. If the key is not present in the configuration object, the getter will returnNone
.deepcopy_val (bool) – If
True
, the values will be deepcopied upon lookup. This prevents accidental modification of mutable types (like lists) by the user.
Attributes
help
inheritedHelp description associated with the key.
name
inheritedName of that key.
parent
inheritedParent
LevelKeyDesc
.Properties
Unique type associated with that key.
path
inheritedPath in the config file from the root to that key.
qualname
inheritedQualified name of the configuration key used for error reporting.
Methods
Get a help message describing the key.
Format the value for pretty printing.
Check that the value is an instance of one of the type specified in the
self.classinfo
.
Attributes#
- KeyDesc.help#
Inherited attribute, see
lisa.conf.KeyDescBase.help
Help description associated with the key.
- KeyDesc.name#
Inherited attribute, see
lisa.conf.KeyDescBase.name
Name of that key.
- KeyDesc.parent#
Inherited attribute, see
lisa.conf.KeyDescBase.parent
Parent
LevelKeyDesc
.
Properties#
- property KeyDesc.newtype[source]#
Unique type associated with that key.
This allows refering unambiguously to the type of a configuration key, linking directly a type annotation to the value of a specific key.
- property KeyDesc.path#
Inherited property, see
lisa.conf.KeyDescBase.path
Path in the config file from the root to that key.
- property KeyDesc.qualname#
Inherited property, see
lisa.conf.KeyDescBase.qualname
Qualified name of the configuration key used for error reporting.
Methods#
- KeyDesc.get_help(style=None, last=False, children=True)[source]#
Get a help message describing the key.