(self, timestamp: int)
| 27 | return self.history |
| 28 | |
| 29 | def validate(self, timestamp: int): |
| 30 | if not self.valid: |
| 31 | raise Exception("Invalid state.") |
| 32 | elif timestamp < self.timestamp: |
| 33 | print("Invalid timestamp.") |
| 34 | self.valid = False |
| 35 | raise Exception(f"Update with timestamp ({timestamp}) is lower than the last timestamp ({self.timestamp}). Invalid state.") |
| 36 | |
| 37 | def process(self, update: Update): |
| 38 | value = json.dumps(update['value']) |