betty.config.collections package - Betty 0.4.0a3 documentation

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.

  Parameters:

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

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

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

  abstract append(*configurations: betty.config.collections._ConfigurationT) → None

    Append the given values to the end of the sequence.

    Parameters:

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

    Return type:

      `None`

  clear() → None

    Clear all items from the collection.

    Return type:

      `None`

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

    Insert the given values at the given index.

    Parameters:

      - index (`int`)

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

    Return type:

      `None`

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

    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

    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

    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

    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

    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

    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

    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

    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

    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

    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]

    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

    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]

    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]

    Get all values in this collection.

    Return type:

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