swh.core.collections module

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

Bases: Generic[swh.core.collections.SortedListKey, swh.core.collections.SortedListItem]

data: List[Tuple[swh.core.collections.SortedListKey, swh.core.collections.SortedListItem]]
add(item: swh.core.collections.SortedListItem)[source]
iter_from(start_key: Any) Iterator[swh.core.collections.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[swh.core.collections.SortedListItem][source]

Same as iter_from, but using a strict inequality.