if not self.datetime:
raise HandledException(f'Given date of wrong format: {self.date}')
- def save(self, db_conn: DatabaseConnection):
- """Add (or re-write) self to database."""
- db_conn.exec('REPLACE INTO days VALUES (?)', (self.date,))
+ def __eq__(self, other: object):
+ return isinstance(other, self.__class__) and self.date == other.date
+
+ def __lt__(self, other):
+ return self.date < other.date
@classmethod
def from_table_row(cls, row: Row):
"""Return what weekday matches self.date."""
return self.datetime.strftime('%A')
- def __eq__(self, other: object):
- return isinstance(other, self.__class__) and self.date == other.date
-
- def __lt__(self, other):
- return self.date < other.date
+ def save(self, db_conn: DatabaseConnection):
+ """Add (or re-write) self to database."""
+ db_conn.exec('REPLACE INTO days VALUES (?)', (self.date,))