From f46f5bd05c4f50d5e70e0174f9ba60a76d4f12c0 Mon Sep 17 00:00:00 2001 From: MrTyton Date: Wed, 25 Sep 2024 02:08:32 -0400 Subject: [PATCH] Hash function. --- release-versions/latest.txt | 2 +- root/app/fanfic_info.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/release-versions/latest.txt b/release-versions/latest.txt index 562c3e9..eccf005 100644 --- a/release-versions/latest.txt +++ b/release-versions/latest.txt @@ -1 +1 @@ -2024.09.24 \ No newline at end of file +2024.09.25 \ No newline at end of file diff --git a/root/app/fanfic_info.py b/root/app/fanfic_info.py index de81211..c301799 100644 --- a/root/app/fanfic_info.py +++ b/root/app/fanfic_info.py @@ -116,3 +116,14 @@ def __eq__(self, other: object) -> bool: and self.site == other.site and self.calibre_id == other.calibre_id ) + + def __hash__(self) -> int: + """ + Returns a hash value for this FanficInfo instance. + + The hash value is computed based on the URL, site, and Calibre ID of the story. + + Returns: + int: The hash value of the FanficInfo instance. + """ + return hash((self.url, self.site, self.calibre_id))