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 inherited

Name of that key.

parent inherited

Parent LevelKeyDesc.

Properties

help

Help description associated with the key.

newtype inherited

Unique type associated with that key.

path inherited

Path in the config file from the root to that key.

qualname inherited

Qualified name of the configuration key used for error reporting.

Methods

can_be_computed()

compute_val()

get_non_evaluated_base_keys()

Get the KeyDescBase of base keys that have a DeferredValue value.

get_src()

make_get_key()

get_help() inherited

Get a help message describing the key.

pretty_format() inherited

Format the value for pretty printing.

validate_val() inherited

Check 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.help[source]#
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.can_be_computed(conf)[source]#
DerivedKeyDesc.compute_val(conf, eval_deferred=True)[source]#
DerivedKeyDesc.get_non_evaluated_base_keys(conf)[source]#

Get the KeyDescBase of base keys that have a DeferredValue value.

DerivedKeyDesc.get_src(conf)[source]#
static DerivedKeyDesc.make_get_key(conf, **kwargs)[source]#
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.