betty.collections.keyed.adapter module¶
Adapters between keyed collections and Python data types.
- class betty.collections.keyed.adapter.KeyedCollectionAdapter¶
Bases:
KeyedCollection,GenericA collection of values that are accessible by their primary keys.
- __init__(values: Mapping[KeyT, ValueT] | Iterable[tuple[KeyT, ValueT]] | None = None, *, key_resolver: Callable[[ResolvableKeyT | KeyT], KeyT] = <function passthrough>)¶
- keys() Iterable[KeyT]¶
Get an iterable over the collection’s keys.
- class betty.collections.keyed.adapter.MutableKeyedCollectionAdapter¶
Bases:
KeyedCollectionAdapter,MutableKeyedCollection,GenericA mutable ordered collection of values that are accessible by their primary keys.
- __init__(values: Iterable[ResolvableValueT] = (), *, key: Callable[[ValueT], KeyT], key_resolver: Callable[[ResolvableKeyT | KeyT], KeyT] = <function passthrough>, value_resolver: Callable[[ResolvableValueT | ValueT], ValueT] = <function passthrough>)¶