betty.config.collections package

Submodules

Module contents

Define and provide collections of betty.config.Configuration instances.

class betty.config.collections.ConfigurationCollection[source]

Bases: Configuration, Generic[_ConfigurationKeyT, _ConfigurationT]

Any collection of betty.config.Configuration values.

__init__(configurations: Iterable[_ConfigurationT] | None = None)[source]
abstract append(*configurations: _ConfigurationT) None[source]

Append the given values to the end of the sequence.

clear() None[source]

Clear all items from the collection.

abstract insert(index: int, *configurations: _ConfigurationT) None[source]

Insert the given values at the given index.

abstract keys() Iterator[_ConfigurationKeyT][source]

Get all keys in this collection.

abstract load_item(dump: Dump) _ConfigurationT[source]

Create and load a new item from the given dump, or raise an assertion error.

Raises:

betty.assertion.error.AssertionFailed – Raised when the dump is invalid and cannot be loaded.

abstract prepend(*configurations: _ConfigurationT) None[source]

Prepend the given values to the beginning of the sequence.

remove(*configuration_keys: _ConfigurationKeyT) None[source]

Remove the given keys from the collection.

abstract replace(*configurations: _ConfigurationT) None[source]

Replace any existing values with the given ones.

abstract to_index(configuration_key: _ConfigurationKeyT) int[source]

Get the index for the given key.

to_indices(*configuration_keys: _ConfigurationKeyT) Iterator[int][source]

Get the indices for the given keys.

abstract to_key(index: int) _ConfigurationKeyT[source]

Get the key for the item at the given index.

to_keys(*indices: int | slice) Iterator[_ConfigurationKeyT][source]

Get the keys for the items at the given indices.

abstract values() Iterator[_ConfigurationT][source]

Get all values in this collection.