Remove the item with the largest/smallest (depending on ``self.heap_order``) priority from the queue and return it. Notes ----- In contrast to :meth:`peek`, this operation is `O(log N)`. Returns ------- item : :class:`PQNode` instanc
(self)
| 125 | self.pop() |
| 126 | |
| 127 | def pop(self): |
| 128 | """ |
| 129 | Remove the item with the largest/smallest (depending on |
| 130 | ``self.heap_order``) priority from the queue and return it. |
| 131 | |
| 132 | Notes |
| 133 | ----- |
| 134 | In contrast to :meth:`peek`, this operation is `O(log N)`. |
| 135 | |
| 136 | Returns |
| 137 | ------- |
| 138 | item : :class:`PQNode` instance or None |
| 139 | Item with the largest/smallest priority, depending on |
| 140 | ``self.heap_order``. |
| 141 | """ |
| 142 | item = heapq.heappop(self._pq).to_dict() |
| 143 | if self.heap_order == "max": |
| 144 | item["priority"] = -1 * item["priority"] |
| 145 | self._count -= 1 |
| 146 | return item |
| 147 | |
| 148 | def peek(self): |
| 149 | """ |
no test coverage detected