Total Complexity | 6 |
Total Lines | 15 |
Duplicated Lines | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | from copy import deepcopy |
||
8 | class ProfileMessage: |
||
9 | def __init__(self, msg, previous): |
||
10 | self.previous = previous |
||
11 | self.msg = deepcopy(msg) |
||
12 | self.count = previous.count + 1 if previous is not None else 1 |
||
13 | self.timestamp = time.time() |
||
14 | self.firstTimestamp = previous.firstTimestamp if previous is not None else self.timestamp |
||
15 | |||
16 | def __str__(self): |
||
17 | return str(self.msg.deviceNumber) |
||
18 | |||
19 | @staticmethod |
||
20 | def decode(cls, msg: BroadcastMessage): |
||
21 | if msg.deviceType in cls.match: |
||
22 | cls.match[msg.deviceType]() |