betty.config.collections.sequence module - 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.sequence module

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

class betty.config.collections.sequence.ConfigurationSequence

  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)
    Parameters:

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

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

    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]

    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

    Insert the given values at the given index.

    Parameters:

      - index (`int`)

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

    Return type:

      `None`

  keys() → Iterator[int]

    Get all keys in this collection.

    Return type:

      `typing.Iterator`[`int`]

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

    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

    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

    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

    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

    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

    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

    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

    Get the index for the given key.

    Parameters:

      configuration_key (`int`)

    Return type:

      `int`

  to_key(index: int) → int

    Get the key for the item at the given index.

    Parameters:

      index (`int`)

    Return type:

      `int`

  update(other: Self) → None

    Update this configuration with the values from `other`.

    Parameters:

      other (`typing.Self`)

    Return type:

      `None`

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

    Get all values in this collection.

    Return type:

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