betty.config.collections.mapping module¶
Define and provide key-value mappings of betty.config.Configuration
instances.
- class betty.config.collections.mapping.ConfigurationMapping[source]¶
Bases:
ConfigurationCollection
[_ConfigurationKeyT
,_ConfigurationT
],Generic
[_ConfigurationKeyT
,_ConfigurationT
]A key-value mapping where values are
betty.config.Configuration
.- Parameters:
configurations (
typing.Optional
[typing.Iterable
[typing.TypeVar
(_ConfigurationT
, bound=betty.config.Configuration
)]])
- __init__(configurations: Iterable[betty.config.collections.mapping._ConfigurationT] | None = None)[source]¶
- Parameters:
configurations (
typing.Optional
[typing.Iterable
[typing.TypeVar
(_ConfigurationT
, bound=betty.config.Configuration
)]])
- append(*configurations: betty.config.collections.mapping._ConfigurationT) None [source]¶
Append the given values to the end of the sequence.
- Parameters:
configurations (
typing.TypeVar
(_ConfigurationT
, bound=betty.config.Configuration
))- Return type:
- 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] [source]¶
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.mapping._ConfigurationT) None [source]¶
Insert the given values at the given index.
- Parameters:
index (
int
)configurations (
typing.TypeVar
(_ConfigurationT
, bound=betty.config.Configuration
))
- Return type:
- keys() Iterator[betty.config.collections.mapping._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
]])]
- load(dump: bool | int | float | str | None | Sequence[Dump] | Mapping[str, Dump]) None [source]¶
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:
- move_to_beginning(*configuration_keys: betty.config.collections.mapping._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:
- move_to_end(*configuration_keys: betty.config.collections.mapping._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:
- move_towards_beginning(*configuration_keys: betty.config.collections.mapping._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:
- move_towards_end(*configuration_keys: betty.config.collections.mapping._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:
- prepend(*configurations: betty.config.collections.mapping._ConfigurationT) None [source]¶
Prepend the given values to the beginning of the sequence.
- Parameters:
configurations (
typing.TypeVar
(_ConfigurationT
, bound=betty.config.Configuration
))- Return type:
- replace(*values: betty.config.collections.mapping._ConfigurationT) None [source]¶
Replace any existing values with the given ones.
- Parameters:
values (
typing.TypeVar
(_ConfigurationT
, bound=betty.config.Configuration
))- Return type:
- to_index(configuration_key: betty.config.collections.mapping._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_key(index: int) betty.config.collections.mapping._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
]])
- update(other: Self) None [source]¶
Update this configuration with the values from
other
.- Parameters:
other (
typing.Self
)- Return type:
- values() Iterator[betty.config.collections.mapping._ConfigurationT] [source]¶
Get all values in this collection.
- Return type:
typing.Iterator
[typing.TypeVar
(_ConfigurationT
, bound=betty.config.Configuration
)]