swh.model.collections module

Utility data structures.

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

Bases: collections.abc.Mapping, Generic[swh.model.collections.KT, swh.model.collections.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[swh.model.collections.KT, swh.model.collections.VT], ...]
items() a set-like object providing a view on D's items[source]
copy_pop(popped_key) Tuple[Optional[swh.model.collections.VT], swh.model.collections.ImmutableDict[swh.model.collections.KT, swh.model.collections.VT]][source]

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