"""Attributes whose values are recorded as a timestamped history."""
from datetime import datetime
from typing import Any
+from sqlite3 import Row
from plomtask.db import DatabaseConnection
or value != self.history[self._newest_timestamp]:
self.history[datetime.now().strftime('%Y-%m-%d %H:%M:%S')] = value
+ def history_from_row(self, row: Row) -> None:
+ """Extend self.history from expected table row format."""
+ self.history[row[1]] = row[2]
+
def at(self, queried_time: str) -> str | float:
"""Retrieve value of timestamp nearest queried_time from the past."""
sorted_timestamps = sorted(self.history.keys())