sampo.utilities.priority_queue#

Overview#

Classes#

PriorityQueue

Abstract base class for generic types.

Attributes#

T

-

Classes#

class sampo.utilities.priority_queue.PriorityQueue(lst: list[T], descending: bool = False, key_getter: Callable[[T], float] = lambda x: ...)#

Bases: Generic[T]

Abstract base class for generic types.

A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:

class Mapping(Generic[KT, VT]):
    def __getitem__(self, key: KT) -> VT:
        ...
    # Etc.

This class can then be used as follows:

def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
    try:
        return mapping[key]
    except KeyError:
        return default
_h: sortedcontainers.SortedKeyList#
_key_getter: Callable[[T], float]#
static empty(descending: bool = False, key_getter: Callable[[T], float] = lambda x: ...)#
add(value: T)#
extract_extremum() T#
replace(old: T, new: T)#
decrease_key(value: T)#
__len__()#

Attributes#

sampo.utilities.priority_queue.T#