swh.core.collections module#

class swh.core.collections.SortedList(data: List[SortedListItem] = [], key: Callable[[SortedListItem], SortedListKey] | None = None)[source]#

Bases: Generic[SortedListKey, SortedListItem]

data: List[Tuple[SortedListKey, SortedListItem]]#
add(item: SortedListItem)[source]#
iter_from(start_key: Any) Iterator[SortedListItem][source]#

Returns an iterator over all the elements whose key is greater or equal to start_key. (This is an efficient equivalent to: (x for x in L if key(x) >= start_key))

iter_after(start_key: Any) Iterator[SortedListItem][source]#

Same as iter_from, but using a strict inequality.