exopy.utils.priority_heap module

Priority heap based on list and heapq module.

class exopy.utils.priority_heap.PriorityHeap[source]

Bases: object

A priority heap implementation based on a heapq.

push(priority, obj)[source]

Push a task with a given priority on the queue.

Parameters
  • priority (int) – Priority associated with the object to push.

  • obj – Object to push on the heap.

pop()[source]

Pop a task from the queue.

remove(obj)[source]

Mark a task as being outdated.

This is the only way to remove an object from a heap without messing with the sorting.