-
Notifications
You must be signed in to change notification settings - Fork 0
/
observer2.py
45 lines (30 loc) · 902 Bytes
/
observer2.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
"""
This implementation is slightly different
Optimzations
1: Weather Station can have any number of data points,
2: Weather publishers is bound to weather station, but station can have multiple weather publishers
3: Display can have only 1 publisher also
"""
from abc import ABCMeta, abstractmethod
class DataPoints(metaclass=ABCMeta):
@abstractmethod
def data_value(self):
NotImplementedError
@abstractmethod
def data_unit(self):
NotImplementedError
@abstractmethod
def data_output(self):
NotImplementedError
class TempratureDataPoint(DataPoints):
def data_value(self):
return 42
def data_unit(self):
return 'selcius'
def data_output(self):
return self.data_value() + ' ' + self.data_unit()
class SourceDataPoints:
def add_data_point(self):
pass
class Source(metaclass=ABCMeta):
pass