-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathalarm.py
31 lines (24 loc) · 904 Bytes
/
alarm.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
def is_event_logged(event, events):
"""
Check if an event was logged in events
:param event: the event to check
:param events: the list of events already logged
:return: true if the event has been logged, otherwise false
"""
return event in events
def is_last_event_greater(gt, events):
"""
Check if the last event was greater than a specified value
:param gt: the threshold to return true
:param events: the list of events already logged
:return: true if the last event was greater than gt, otherwise false
"""
return events[-1] > gt
def is_last_event_less(lt, events):
"""
Check if the last event was less than a specified value
:param lt: the threshold to return true
:param events: the list of events already logged
:return: true if the last event was less than lt, otherwise false
"""
return events[-1] < lt