Skip to content

Commit 1df0f03

Browse files
committed
move cache to module level
1 parent 00e2f44 commit 1df0f03

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

pyiceberg/table/snapshots.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,15 @@ def __eq__(self, other: Any) -> bool:
231231
)
232232

233233

234+
@lru_cache
235+
def _manifests(io: FileIO, manifest_list: Optional[str]) -> List[ManifestFile]:
236+
"""Return the manifests from the manifest list."""
237+
if manifest_list not in (None, ""):
238+
file = io.new_input(manifest_list) # type: ignore
239+
return list(read_manifest_list(file))
240+
return []
241+
242+
234243
class Snapshot(IcebergBaseModel):
235244
snapshot_id: int = Field(alias="snapshot-id")
236245
parent_snapshot_id: Optional[int] = Field(alias="parent-snapshot-id", default=None)
@@ -250,18 +259,9 @@ def __str__(self) -> str:
250259
result_str = f"{operation}id={self.snapshot_id}{parent_id}{schema_id}"
251260
return result_str
252261

253-
@staticmethod
254-
@lru_cache
255-
def _manifests(io: FileIO, manifest_list: Optional[str]) -> List[ManifestFile]:
256-
"""Return the manifests for the given snapshot."""
257-
if manifest_list not in (None, ""):
258-
file = io.new_input(manifest_list) # type: ignore
259-
return list(read_manifest_list(file))
260-
return []
261-
262262
def manifests(self, io: FileIO) -> List[ManifestFile]:
263263
"""Return the manifests for the given snapshot."""
264-
return Snapshot._manifests(io, self.manifest_list)
264+
return _manifests(io, self.manifest_list)
265265

266266

267267
class MetadataLogEntry(IcebergBaseModel):

0 commit comments

Comments
 (0)