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[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:
- abstract insert(index: int, *configurations: betty.config.collections._ConfigurationT) None [source]¶
Insert the given values at the given index.
- Parameters:
index (
int
)configurations (
typing.TypeVar
(_ConfigurationT
, bound=betty.config.Configuration
))
- Return type:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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
)]