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.

Parameters:

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

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

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

abstract append(*configurations: betty.config.collections._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

clear() None[source]

Clear all items from the collection.

Return type:

None

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

Insert the given values at the given index.

Parameters:
Return type:

None

abstract keys() Iterator[betty.config.collections._ConfigurationKeyT][source]

Get all keys in this collection.

Return type:

typing.Iterator[typing.TypeVar(_ConfigurationKeyT, bound= typing.Union[typing.SupportsIndex, typing.Hashable, type[typing.Any]])]

abstract load_item(dump: bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]) betty.config.collections._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.

Parameters:

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

Return type:

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

abstract move_to_beginning(*configuration_keys: betty.config.collections._ConfigurationKeyT) None[source]

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

Parameters:

configuration_keys (typing.TypeVar(_ConfigurationKeyT, bound= typing.Union[typing.SupportsIndex, typing.Hashable, type[typing.Any]]))

Return type:

None

abstract move_to_end(*configuration_keys: betty.config.collections._ConfigurationKeyT) None[source]

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

Parameters:

configuration_keys (typing.TypeVar(_ConfigurationKeyT, bound= typing.Union[typing.SupportsIndex, typing.Hashable, type[typing.Any]]))

Return type:

None

abstract move_towards_beginning(*configuration_keys: betty.config.collections._ConfigurationKeyT) None[source]

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

Parameters:

configuration_keys (typing.TypeVar(_ConfigurationKeyT, bound= typing.Union[typing.SupportsIndex, typing.Hashable, type[typing.Any]]))

Return type:

None

abstract move_towards_end(*configuration_keys: betty.config.collections._ConfigurationKeyT) None[source]

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

Parameters:

configuration_keys (typing.TypeVar(_ConfigurationKeyT, bound= typing.Union[typing.SupportsIndex, typing.Hashable, type[typing.Any]]))

Return type:

None

abstract prepend(*configurations: betty.config.collections._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

remove(*configuration_keys: betty.config.collections._ConfigurationKeyT) None[source]

Remove the given keys from the collection.

Parameters:

configuration_keys (typing.TypeVar(_ConfigurationKeyT, bound= typing.Union[typing.SupportsIndex, typing.Hashable, type[typing.Any]]))

Return type:

None

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

Replace any existing values with the given ones.

Parameters:

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

Return type:

None

abstract to_index(configuration_key: betty.config.collections._ConfigurationKeyT) int[source]

Get the index for the given key.

Parameters:

configuration_key (typing.TypeVar(_ConfigurationKeyT, bound= typing.Union[typing.SupportsIndex, typing.Hashable, type[typing.Any]]))

Return type:

int

to_indices(*configuration_keys: betty.config.collections._ConfigurationKeyT) Iterator[int][source]

Get the indices for the given keys.

Parameters:

configuration_keys (typing.TypeVar(_ConfigurationKeyT, bound= typing.Union[typing.SupportsIndex, typing.Hashable, type[typing.Any]]))

Return type:

typing.Iterator[int]

abstract to_key(index: int) betty.config.collections._ConfigurationKeyT[source]

Get the key for the item at the given index.

Parameters:

index (int)

Return type:

typing.TypeVar(_ConfigurationKeyT, bound= typing.Union[typing.SupportsIndex, typing.Hashable, type[typing.Any]])

to_keys(*indices: int | slice) Iterator[betty.config.collections._ConfigurationKeyT][source]

Get the keys for the items at the given indices.

Parameters:

indices (int | slice)

Return type:

typing.Iterator[typing.TypeVar(_ConfigurationKeyT, bound= typing.Union[typing.SupportsIndex, typing.Hashable, type[typing.Any]])]

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

Get all values in this collection.

Return type:

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