-
Notifications
You must be signed in to change notification settings - Fork 0
/
dee.py
69 lines (48 loc) · 1.78 KB
/
dee.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import time
class Mechanical:
def __init__(self, date):
self.date = date
def __setattr__(self, key, value):
if key == "date" and key in self.__dict__:
return
super().__setattr__(key, value)
ddvdddds
class Aragon:
def __init__(self, date):
self.date = date
def __setattr__(self, key, value):
if key == "date" and key in self.__dict__:
return
super().__setattr__(key, value)
class Calcium:
def __init__(self, date):
self.date = date
def __setattr__(self, key, value):
if key == "date" and key in self.__dict__:
return
super().__setattr__(key, value)
class GeyserClassic:
MAX_DATE_FILTER = 100
def __init__(self):
self.filter_class = ('Mechanical', 'Aragon', 'Calcium')
self.filters = {(1, self.filter_class[0]): None, (2, self.filter_class[1]): None, (3, self.filter_class[2]): None }
def add_filter(self, slot_num, filter):
key = (slot_num, filter.__class__.__name__)
if key in self.filters and not self.filters[key]:
self.filters[key] = filter
def remove_filter(self, slot_num):
if type(slot_num) == int and 1 <= slot_num <= 3:
key = (slot_num, self.filter_class[slot_num - 1])
if key in self.filters:
self.filters[key] = None
def get_filters(self):
return tuple(self.filters.values())
def water_on(self):
end = time.time()
for f in self.filters.values():
if f is None:
return False
start = f.date
if end - start > self.MAX_DATE_FILTER:
return False
return True