swh.core.collections module

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

Bases: Generic[swh.core.collections.SortedListKey, swh.core.collections.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.