betty.datas.aggregate.collection.keyed module

Keyed collection definitions.

class betty.datas.aggregate.collection.keyed.KeyedCollectionDefinition

Bases: CollectionDefinition[MutableKeyedCollectionT, Iterable, ElementT], Generic

A definition for betty.collection.keyed.MutableKeyedCollection.

__init__(*, cls: type[MutableKeyedCollection] | None = None, value: RecordDefinition[ValueT, ElementT] | type[Intersection[ValueT, Data[RecordDefinition[Any, ElementT]]]], key: ElementT, order_dump: bool = False, label: ResolvableLocalizable, description: ResolvableLocalizable | None = None, factory: Callable[[], MutableKeyedCollectionT] | None = None)
final clear(data: MutableKeyedCollectionT, /) None

Clear (remove) all values from the collection.

final replace(data: MutableKeyedCollectionT, values: Iterable[ValueT], /) None

Replace all values in the collection with the given ones.