home · contact · privacy
To fix sync, add comparison and string representation to Hash class.
authorChristian Heller <c.heller@plomlompom.de>
Tue, 3 Dec 2024 03:03:33 +0000 (04:03 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Tue, 3 Dec 2024 03:03:33 +0000 (04:03 +0100)
src/ytplom/db.py

index 5387ecaac55553339cdd5cb70c00bbabcc666bf4..30d84fc1bfffff70acdc16f4ef66a1a2cde6fa4e 100644 (file)
@@ -31,6 +31,14 @@ class Hash:
     def __init__(self, as_bytes: bytes) -> None:
         self.bytes = as_bytes
 
+    def __eq__(self, other):
+        if not isinstance(other, Hash):
+            return False
+        return self.bytes == other.bytes
+
+    def __str__(self):
+        return self.b64
+
     @classmethod
     def from_file(cls, path: Path) -> Self:
         """Hash-digest file at path, instantiate with hash's bytes."""