betty.config.collections.sequence module

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

class betty.config.collections.sequence.ConfigurationSequence[source]

Bases: ConfigurationCollection[int, _ConfigurationT], Generic[_ConfigurationT]

A sequence of configuration values.

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

Append the given values to the end of the sequence.

dump() bool | int | float | str | None | MutableSequence[bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | MutableMapping[str, bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]] | type[Void][source]

Dump this instance to a portable format.

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

Insert the given values at the given index.

keys() Iterator[int][source]

Get all keys in this collection.

load(dump: bool | int | float | str | None | MutableSequence[Dump] | MutableMapping[str, Dump]) None[source]

Load dumped configuration.

Raises:

betty.assertion.error.AssertionFailed – Raised if the dump contains invalid configuration.

move_to_beginning(*configuration_keys: int) None[source]

Move the given keys (and their values) to the beginning of the sequence.

move_to_end(*configuration_keys: int) None[source]

Move the given keys (and their values) to the end of the sequence.

move_towards_beginning(*configuration_keys: int) None[source]

Move the given keys (and their values) one place towards the beginning of the sequence.

move_towards_end(*configuration_keys: int) None[source]

Move the given keys (and their values) one place towards the end of the sequence.

prepend(*configurations: _ConfigurationT) None[source]

Prepend the given values to the beginning of the sequence.

replace(*configurations: _ConfigurationT) None[source]

Replace any existing values with the given ones.

to_index(configuration_key: int) int[source]

Get the index for the given key.

to_key(index: int) int[source]

Get the key for the item at the given index.

update(other: Self) None[source]

Update this configuration with the values from other.

values() Iterator[_ConfigurationT][source]

Get all values in this collection.