|
@@ -1,27 +1,25 @@
|
|
|
-from gmail import *
|
|
|
+import heapq
|
|
|
|
|
|
-class event:
|
|
|
- def __init__(self):
|
|
|
- pass
|
|
|
-
|
|
|
-class Event(event):
|
|
|
- def __init__(self, date, location, body, eid):
|
|
|
+class Event():
|
|
|
+ def __init__(self, date, location, description):
|
|
|
self.date = date
|
|
|
self.location = location
|
|
|
- self.body = body
|
|
|
- self.eid = eid
|
|
|
-
|
|
|
- def affiche(self):
|
|
|
- print('<Date>: %s' % self.date)
|
|
|
- print('<Location>: %s' % self.location)
|
|
|
+ self.description = description
|
|
|
+
|
|
|
+
|
|
|
+class HeapEvent():
|
|
|
+ """Heap for event : sort event according to their dates"""
|
|
|
+ def __init__(self):
|
|
|
+ self.data = []
|
|
|
+
|
|
|
+ def push(self, event):
|
|
|
+ heapq.heappush(self.data, (event.date, event))
|
|
|
+
|
|
|
+ def pop(self):
|
|
|
+ return heapq.heappop(self.data)[1]
|
|
|
|
|
|
- if (self.eid == "m"):
|
|
|
- print('<Body>: %s' % self.body.decode())
|
|
|
- elif (self.eid == "c"):
|
|
|
- print('<Body>: %s' % self.body)
|
|
|
-
|
|
|
- def problem(self):
|
|
|
- #TODO: Call the function of RATP
|
|
|
- return "TODO"
|
|
|
-
|
|
|
+ def top(self):
|
|
|
+ return self.data[0][1]
|
|
|
|
|
|
+ def empty(self):
|
|
|
+ return not self.data
|