Skip to content

Commit

Permalink
Hash function.
Browse files Browse the repository at this point in the history
  • Loading branch information
MrTyton committed Sep 25, 2024
1 parent 9b0bc9d commit f46f5bd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion release-versions/latest.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2024.09.24
2024.09.25
11 changes: 11 additions & 0 deletions root/app/fanfic_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))

0 comments on commit f46f5bd

Please sign in to comment.