MCPcopy Index your code
hub / github.com/RustPython/RustPython / heappop

Function heappop

Lib/heapq.py:138–146  ·  view source on GitHub ↗

Pop the smallest item off the heap, maintaining the heap invariant.

(heap)

Source from the content-addressed store, hash-verified

136 _siftdown(heap, 0, len(heap)-1)
137
138def heappop(heap):
139 """Pop the smallest item off the heap, maintaining the heap invariant."""
140 lastelt = heap.pop() # raises appropriate IndexError if heap is empty
141 if heap:
142 returnitem = heap[0]
143 heap[0] = lastelt
144 _siftup(heap, 0)
145 return returnitem
146 return lastelt
147
148def heapreplace(heap, item):
149 """Pop and return the current smallest value, and add the new item.

Callers 2

_getMethod · 0.90
_getMethod · 0.85

Calls 2

_siftupFunction · 0.85
popMethod · 0.45

Tested by

no test coverage detected