mirror of
https://github.com/iritmaximus/tira.git
synced 2026-10-12 19:13:47 +03:00
13 lines
230 B
Python
13 lines
230 B
Python
import heapq
|
|
|
|
|
|
class Tasks:
|
|
def __init__(self):
|
|
self.t = []
|
|
|
|
def add_task(self, name, priority):
|
|
heapq.heappush(self.t, (-priority, name))
|
|
|
|
def fetch_task(self):
|
|
return heapq.heappop(self.t)[1]
|