Example #1
0
 def pop(self):
     if len(self.heap) == 0:
         raise HeapError("Popping off an empty hipster")
     return self.heap.pop()
Example #2
0
 def peek(self):
     if len(self.heap) == 0:
         raise HeapError("Peeking into an empty heap")
     with self.read_lock:
         return heapq.nsmallest(1, self.heap)[0]
Example #3
0
 def peek(self):
     if len(self.heap) == 0:
         raise HeapError("Peeking into an empty hipster")
     return heapq.nlargest(1, self.heap)[0]
Example #4
0
 def pop(self):
     if len(self.heap) == 0:
         raise HeapError("Popping off an empty heap")
     with self.write_lock:
         return heapq.heappop(self.heap)