You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iceberg.apache.org by fo...@apache.org on 2025/08/05 08:31:09 UTC

(iceberg-python) branch main updated: Add `__eq__` and `__hash__` methods to `ManifestFile` (#2233)

This is an automated email from the ASF dual-hosted git repository.

fokko pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg-python.git


The following commit(s) were added to refs/heads/main by this push:
     new 5c604c23 Add `__eq__` and `__hash__` methods to `ManifestFile` (#2233)
5c604c23 is described below

commit 5c604c23b94519193e1f85e1cc8a89ade81eb9c0
Author: smaheshwar-pltr <ma...@gmail.com>
AuthorDate: Tue Aug 5 09:31:05 2025 +0100

    Add `__eq__` and `__hash__` methods to `ManifestFile` (#2233)
---
 pyiceberg/manifest.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/pyiceberg/manifest.py b/pyiceberg/manifest.py
index 362e9085..a92d9448 100644
--- a/pyiceberg/manifest.py
+++ b/pyiceberg/manifest.py
@@ -866,6 +866,14 @@ class ManifestFile(Record):
                 if not discard_deleted or entry.status != ManifestEntryStatus.DELETED
             ]
 
+    def __eq__(self, other: Any) -> bool:
+        """Return the equality of two instances of the ManifestFile class."""
+        return self.manifest_path == other.manifest_path if isinstance(other, ManifestFile) else False
+
+    def __hash__(self) -> int:
+        """Return the hash of manifest_path."""
+        return hash(self.manifest_path)
+
 
 @cached(cache=LRUCache(maxsize=128), key=lambda io, manifest_list: hashkey(manifest_list))
 def _manifests(io: FileIO, manifest_list: str) -> Tuple[ManifestFile, ...]: