Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.config.collections package

## Submodules

- betty.config.collections.mapping module
  - `ConfigurationMapping`
    - `ConfigurationMapping.__init__()`
    - `ConfigurationMapping.append()`
    - `ConfigurationMapping.dump()`
    - `ConfigurationMapping.insert()`
    - `ConfigurationMapping.keys()`
    - `ConfigurationMapping.load()`
    - `ConfigurationMapping.move_to_beginning()`
    - `ConfigurationMapping.move_to_end()`
    - `ConfigurationMapping.move_towards_beginning()`
    - `ConfigurationMapping.move_towards_end()`
    - `ConfigurationMapping.prepend()`
    - `ConfigurationMapping.replace()`
    - `ConfigurationMapping.to_index()`
    - `ConfigurationMapping.to_key()`
    - `ConfigurationMapping.update()`
    - `ConfigurationMapping.values()`
- betty.config.collections.sequence module
  - `ConfigurationSequence`
    - `ConfigurationSequence.__init__()`
    - `ConfigurationSequence.append()`
    - `ConfigurationSequence.dump()`
    - `ConfigurationSequence.insert()`
    - `ConfigurationSequence.keys()`
    - `ConfigurationSequence.load()`
    - `ConfigurationSequence.move_to_beginning()`
    - `ConfigurationSequence.move_to_end()`
    - `ConfigurationSequence.move_towards_beginning()`
    - `ConfigurationSequence.move_towards_end()`
    - `ConfigurationSequence.prepend()`
    - `ConfigurationSequence.replace()`
    - `ConfigurationSequence.to_index()`
    - `ConfigurationSequence.to_key()`
    - `ConfigurationSequence.update()`
    - `ConfigurationSequence.values()`

## Module contents

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

class betty.config.collections.ConfigurationCollection

  Bases: `Configuration`, `Generic`[`_ConfigurationKeyT`, `_ConfigurationT`]

  Any collection of `betty.config.Configuration` values.

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

    Append the given values to the end of the sequence.

  clear() → None

    Clear all items from the collection.

  abstract insert(index: int, *configurations: _ConfigurationT) → None

    Insert the given values at the given index.

  abstract keys() → Iterator[_ConfigurationKeyT]

    Get all keys in this collection.

  abstract load_item(dump: Dump) → _ConfigurationT

    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 move_to_beginning(*configuration_keys: _ConfigurationKeyT) → None

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

  abstract move_to_end(*configuration_keys: _ConfigurationKeyT) → None

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

  abstract move_towards_beginning(*configuration_keys: _ConfigurationKeyT) → None

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

  abstract move_towards_end(*configuration_keys: _ConfigurationKeyT) → None

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

  abstract prepend(*configurations: _ConfigurationT) → None

    Prepend the given values to the beginning of the sequence.

  remove(*configuration_keys: _ConfigurationKeyT) → None

    Remove the given keys from the collection.

  abstract replace(*configurations: _ConfigurationT) → None

    Replace any existing values with the given ones.

  abstract to_index(configuration_key: _ConfigurationKeyT) → int

    Get the index for the given key.

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

    Get the indices for the given keys.

  abstract to_key(index: int) → _ConfigurationKeyT

    Get the key for the item at the given index.

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

    Get the keys for the items at the given indices.

  abstract values() → Iterator[_ConfigurationT]

    Get all values in this collection.