lisa.conf.LevelKeyDesc#

class lisa.conf.LevelKeyDesc(name, help, children, value_path=None)[source]#

Bases: KeyDescBase, Mapping

Key descriptor defining a hierarchical level in the configuration.

Parameters:
  • name – name of the key in the configuration

  • help – Short help describing the use of the keys inside that level

  • children (collections.abc.Sequence) – collections.abc.Sequence of KeyDescBase defining the allowed keys under that level

  • value_path (list(str) or None) –

    Relative path to a sub-key that will receive assignment to that level for non-mapping types. This allows turning a leaf key into a level while preserving backward compatibility, as long as:

    • The key did not accept mapping values, otherwise it would be ambiguous and is therefore rejected.

    • The old leaf key has a matching new leaf key, that is a sub-key of the new level key.

    In practice, that allows turning a single knob into a tree of settings.

Children keys will get this key assigned as a parent when passed to the constructor.

Attributes

__reversed__ inherited

See collections.abc.Mapping.__reversed__

help inherited

Help description associated with the key.

name inherited

Name of that key.

parent inherited

Parent LevelKeyDesc.

Properties

key_desc

Leaf KeyDescBase that this level will delegate to in case it is assigned a leaf value.

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

__getattr__()

__getitem__()

__iter__()

__len__()

check_allowed_key()

Checks that a given key is allowed under that levels.

get_help()

Get a help message describing the key.

validate_val()

Validate a mapping to be used as a configuration source.

__class_getitem__() inherited

See collections.abc.Iterable.__class_getitem__()

__contains__() inherited

See collections.abc.Mapping.__contains__()

get() inherited

See collections.abc.Mapping.get()

items() inherited

See collections.abc.Mapping.items()

keys() inherited

See collections.abc.Mapping.keys()

values() inherited

See collections.abc.Mapping.values()

Attributes#

LevelKeyDesc.__reversed__ = None#
LevelKeyDesc.help#

Inherited attribute, see lisa.conf.KeyDescBase.help

Help description associated with the key.

LevelKeyDesc.name#

Inherited attribute, see lisa.conf.KeyDescBase.name

Name of that key.

LevelKeyDesc.parent#

Inherited attribute, see lisa.conf.KeyDescBase.parent

Parent LevelKeyDesc.

Properties#

property LevelKeyDesc.key_desc[source]#

Leaf KeyDescBase that this level will delegate to in case it is assigned a leaf value.

This KeyDescBase is pointed at by the value_path attribute.

property LevelKeyDesc.path#

Inherited property, see lisa.conf.KeyDescBase.path

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

property LevelKeyDesc.qualname#

Inherited property, see lisa.conf.KeyDescBase.qualname

Qualified name of the configuration key used for error reporting.

Methods#

LevelKeyDesc.__getattr__(attr)[source]#
LevelKeyDesc.__getitem__(key)[source]#
LevelKeyDesc.__iter__()[source]#
LevelKeyDesc.__len__()[source]#
LevelKeyDesc.check_allowed_key(key)[source]#

Checks that a given key is allowed under that levels

LevelKeyDesc.get_help(style=None, last=False, children=True)[source]#

Get a help message describing the key.

Parameters:
  • style – When “rst”, ResStructuredText formatting may be applied

  • style – str

  • last (bool) – True if this is the last item in a list.

  • children (bool) – If True, include the help of any children of the current level.

LevelKeyDesc.validate_val(conf)[source]#

Validate a mapping to be used as a configuration source

classmethod LevelKeyDesc.__class_getitem__()#

Inherited method, see collections.abc.Iterable.__class_getitem__()

LevelKeyDesc.__contains__()#

Inherited method, see collections.abc.Mapping.__contains__()

LevelKeyDesc.get()#

Inherited method, see collections.abc.Mapping.get()

LevelKeyDesc.items()#

Inherited method, see collections.abc.Mapping.items()

LevelKeyDesc.keys()#

Inherited method, see collections.abc.Mapping.keys()

LevelKeyDesc.values()#

Inherited method, see collections.abc.Mapping.values()