swh.model.collections module#

class swh.model.collections.ImmutableDict(data: Iterable[Tuple[KT, VT]] | ImmutableDict[KT, VT] | Dict[KT, VT] = {})[source]#

Bases: Mapping, Generic[KT, VT]

A frozen dictionary.

This class behaves like a dictionary, but internally stores objects in a tuple, so it is both immutable and hashable.

property data#
items() a set-like object providing a view on D's items[source]#
copy_pop(popped_key) Tuple[VT | None, ImmutableDict[KT, VT]][source]#

Returns a copy of this ImmutableDict without the given key, as well as the value associated to the key.