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.

Parameters:

configurations (typing.Optional[typing.Iterable[typing.TypeVar(_ConfigurationT, bound= betty.config.Configuration)]])

__init__(configurations: Iterable[betty.config.collections.sequence._ConfigurationT] | None = None)[source]
Parameters:

configurations (typing.Optional[typing.Iterable[typing.TypeVar(_ConfigurationT, bound= betty.config.Configuration)]])

append(*configurations: betty.config.collections.sequence._ConfigurationT) None[source]

Append the given values to the end of the sequence.

Parameters:

configurations (typing.TypeVar(_ConfigurationT, bound= betty.config.Configuration))

Return type:

None

dump() bool | int | float | str | None | Sequence[bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | Mapping[str, bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]] | type[betty.typing.Void][source]

Dump this instance to a portable format.

Return type:

typing.Union[bool, int, float, str, None, typing.Sequence[typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]], typing.Mapping[str, typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]]], type[betty.typing.Void]]

insert(index: int, *configurations: betty.config.collections.sequence._ConfigurationT) None[source]

Insert the given values at the given index.

Parameters:
Return type:

None

keys() Iterator[int][source]

Get all keys in this collection.

Return type:

typing.Iterator[int]

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

Load dumped configuration.

Raises:

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

Parameters:

dump (typing.Union[bool, int, float, str, None, typing.Sequence[Dump], typing.Mapping[str, Dump]])

Return type:

None

move_to_beginning(*configuration_keys: int) None[source]

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

Parameters:

configuration_keys (int)

Return type:

None

move_to_end(*configuration_keys: int) None[source]

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

Parameters:

configuration_keys (int)

Return type:

None

move_towards_beginning(*configuration_keys: int) None[source]

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

Parameters:

configuration_keys (int)

Return type:

None

move_towards_end(*configuration_keys: int) None[source]

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

Parameters:

configuration_keys (int)

Return type:

None

prepend(*configurations: betty.config.collections.sequence._ConfigurationT) None[source]

Prepend the given values to the beginning of the sequence.

Parameters:

configurations (typing.TypeVar(_ConfigurationT, bound= betty.config.Configuration))

Return type:

None

replace(*values: betty.config.collections.sequence._ConfigurationT) None[source]

Replace any existing values with the given ones.

Parameters:

values (typing.TypeVar(_ConfigurationT, bound= betty.config.Configuration))

Return type:

None

to_index(configuration_key: int) int[source]

Get the index for the given key.

Parameters:

configuration_key (int)

Return type:

int

to_key(index: int) int[source]

Get the key for the item at the given index.

Parameters:

index (int)

Return type:

int

update(other: Self) None[source]

Update this configuration with the values from other.

Parameters:

other (typing.Self)

Return type:

None

values() Iterator[betty.config.collections.sequence._ConfigurationT][source]

Get all values in this collection.

Return type:

typing.Iterator[typing.TypeVar(_ConfigurationT, bound= betty.config.Configuration)]