Skip to content

Commit ab6de0d

Browse files
committed
return tuple
1 parent 39c56f6 commit ab6de0d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pyiceberg/table/snapshots.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import time
2020
from collections import defaultdict
2121
from 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

2424
from cachetools import LRUCache, cached
2525
from 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

242242
class 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

Comments
 (0)