1919import time
2020from collections import defaultdict
2121from enum import Enum
22- from typing import TYPE_CHECKING , Any , DefaultDict , Dict , Iterable , List , Mapping , Optional
22+ from typing import TYPE_CHECKING , Any , DefaultDict , Dict , Iterable , List , Mapping , Optional , Tuple
2323
2424from cachetools import LRUCache , cached
2525from cachetools .keys import hashkey
@@ -233,10 +233,10 @@ def __eq__(self, other: Any) -> bool:
233233
234234
235235@cached (cache = LRUCache (maxsize = 128 ), key = lambda io , manifest_list : hashkey (manifest_list ))
236- def _manifests (io : FileIO , manifest_list : str ) -> List [ManifestFile ]:
237- """Return the manifests from the manifest list."""
236+ def _manifests (io : FileIO , manifest_list : str ) -> Tuple [ManifestFile , ... ]:
237+ """Read and cache manifests from the given manifest list, returning a tuple to prevent modification ."""
238238 file = io .new_input (manifest_list )
239- return list (read_manifest_list (file ))
239+ return tuple (read_manifest_list (file ))
240240
241241
242242class Snapshot (IcebergBaseModel ):
@@ -261,7 +261,7 @@ def __str__(self) -> str:
261261 def manifests (self , io : FileIO ) -> List [ManifestFile ]:
262262 """Return the manifests for the given snapshot."""
263263 if self .manifest_list :
264- return _manifests (io , self .manifest_list )
264+ return list ( _manifests (io , self .manifest_list ) )
265265 return []
266266
267267
0 commit comments