Skip to content

Commit af6924d

Browse files
committed
move cache to module level
1 parent afbf031 commit af6924d

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
@@ -229,6 +229,15 @@ def __eq__(self, other: Any) -> bool:
229229
)
230230

231231

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

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

264264

265265
class MetadataLogEntry(IcebergBaseModel):

0 commit comments

Comments
 (0)