swh.model.collections module#

Utility data structures.

class swh.model.collections.ImmutableDict(data: Union[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.

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

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