lisa.conf.DerivedKeyDesc#
- class lisa.conf.DerivedKeyDesc(name, help, classinfo, base_key_paths, compute, newtype=None)[source]#
Bases:
KeyDesc
Key descriptor describing a key derived from other keys
Derived keys cannot be added from a source, since they are purely computed out of other keys. It is also not possible to change their source priorities. To achieve that, set the source priorities on the keys it is based on.
- Parameters:
base_key_paths (list(list(str))) – List of paths to the keys this key is derived from. The paths in the form of a list of string are relative to the current level. To reference a level above the current one, use the special key
..
.compute (collections.abc.Callable) – Function used to compute the value of the key. It takes a dictionary of base keys specified in
base_key_paths
as only parameter and is expected to return the key’s value.
Attributes
name
inheritedName of that key.
parent
inheritedParent
LevelKeyDesc
.Properties
Help description associated with the key.
newtype
inheritedUnique 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 the
KeyDescBase
of base keys that have aDeferredValue
value.get_help()
inheritedGet a help message describing the key.
pretty_format()
inheritedFormat the value for pretty printing.
validate_val()
inheritedCheck that the value is an instance of one of the type specified in the
self.classinfo
.
Attributes#
- DerivedKeyDesc.name#
Inherited attribute, see
lisa.conf.KeyDescBase.name
Name of that key.
- DerivedKeyDesc.parent#
Inherited attribute, see
lisa.conf.KeyDescBase.parent
Parent
LevelKeyDesc
.
Properties#
- property DerivedKeyDesc.newtype#
Inherited property, see
lisa.conf.KeyDesc.newtype
Unique type associated with that key.
- property DerivedKeyDesc.path#
Inherited property, see
lisa.conf.KeyDescBase.path
Path in the config file from the root to that key.
- property DerivedKeyDesc.qualname#
Inherited property, see
lisa.conf.KeyDescBase.qualname
Qualified name of the configuration key used for error reporting.
Methods#
- DerivedKeyDesc.get_non_evaluated_base_keys(conf)[source]#
Get the
KeyDescBase
of base keys that have aDeferredValue
value.
- DerivedKeyDesc.get_help(style=None, last=False, children=True)#
Inherited method, see
lisa.conf.KeyDesc.get_help()
Get a help message describing the key.
- static DerivedKeyDesc.pretty_format(v)#
Inherited method, see
lisa.conf.KeyDesc.pretty_format()
Format the value for pretty printing.
- DerivedKeyDesc.validate_val(val)#
Inherited method, see
lisa.conf.KeyDesc.validate_val()
Check that the value is an instance of one of the type specified in the
self.classinfo
.