home
·
contact
·
privacy
projects
/
ytplom
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1c8d467
)
To fix sync, add comparison and string representation to Hash class.
author
Christian Heller
<c.heller@plomlompom.de>
Tue, 3 Dec 2024 03:03:33 +0000
(
04:03
+0100)
committer
Christian Heller
<c.heller@plomlompom.de>
Tue, 3 Dec 2024 03:03:33 +0000
(
04:03
+0100)
src/ytplom/db.py
patch
|
blob
|
history
diff --git
a/src/ytplom/db.py
b/src/ytplom/db.py
index 5387ecaac55553339cdd5cb70c00bbabcc666bf4..30d84fc1bfffff70acdc16f4ef66a1a2cde6fa4e 100644
(file)
--- a/
src/ytplom/db.py
+++ b/
src/ytplom/db.py
@@
-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."""