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.

To test your own subclasses, use betty.test_utils.config.collections.sequence.ConfigurationSequenceTestBase.

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

Append the given values to the end of the sequence.

dump() DumpSequence[Dump][source]

Produce a serialized data dump of self.

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: Dump) None[source]

Load a serialized data dump into self.

Raises:

betty.assertion.error.AssertionFailed – Raised if the dump is invalid.

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.

values() Iterator[_ConfigurationT][source]

Get all values in this collection.