Skip to content

Commit 7e2ba8e

Browse files
smaheshwar-pltrgabeiglio
authored andcommitted
Add __eq__ and __hash__ methods to ManifestFile (apache#2233)
1 parent 8b49bed commit 7e2ba8e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pyiceberg/manifest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,14 @@ def fetch_manifest_entry(self, io: FileIO, discard_deleted: bool = True) -> List
866866
if not discard_deleted or entry.status != ManifestEntryStatus.DELETED
867867
]
868868

869+
def __eq__(self, other: Any) -> bool:
870+
"""Return the equality of two instances of the ManifestFile class."""
871+
return self.manifest_path == other.manifest_path if isinstance(other, ManifestFile) else False
872+
873+
def __hash__(self) -> int:
874+
"""Return the hash of manifest_path."""
875+
return hash(self.manifest_path)
876+
869877

870878
@cached(cache=LRUCache(maxsize=128), key=lambda io, manifest_list: hashkey(manifest_list))
871879
def _manifests(io: FileIO, manifest_list: str) -> Tuple[ManifestFile, ...]:

0 commit comments

Comments
 (0)