From ee3514078166c4ee2414bf183c0d1a9e8bbf42cd Mon Sep 17 00:00:00 2001 From: altbrace <54287344+altbrace@users.noreply.github.com> Date: Tue, 5 Mar 2024 21:25:21 +0700 Subject: [PATCH] GSImage: add __eq__() and __hash__() methods for easy object comparison --- google_images_search/fetch_resize_save.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/google_images_search/fetch_resize_save.py b/google_images_search/fetch_resize_save.py index d06eba1..c2f271a 100644 --- a/google_images_search/fetch_resize_save.py +++ b/google_images_search/fetch_resize_save.py @@ -393,6 +393,12 @@ def __init__(self, fetch_resize_save): self.resized = False + def __eq__(self, other): + return self.url == other.url + + def __hash__(self): + return hash(self.url) + @property def url(self): """Returns the image url