Skip to content

Commit d104f8c

Browse files
committed
fix code format
1 parent dac2adc commit d104f8c

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

pyiceberg/table/update/snapshot.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
from sortedcontainers import SortedList
2929

30+
from pyiceberg.exceptions import CommitFailedException
3031
from pyiceberg.expressions import (
3132
AlwaysFalse,
3233
BooleanExpression,
@@ -248,7 +249,7 @@ def refresh(self) -> TableMetadata:
248249
return self._transaction._table.metadata
249250

250251
@abstractmethod
251-
def _validate(self, current_metadata: TableMetadata, Snapshot: Optional[Snapshot]) -> None: ...
252+
def _validate(self, current_metadata: TableMetadata, snapshot: Optional[Snapshot]) -> None: ...
252253

253254
def _commit(self) -> UpdatesAndRequirements:
254255
current_snapshot = self._transaction.table_metadata.current_snapshot()
@@ -461,12 +462,12 @@ def files_affected(self) -> bool:
461462
"""Indicate if any manifest-entries can be dropped."""
462463
return len(self._deleted_entries()) > 0
463464

464-
def _validate(self, current_metadata: TableMetadata, Snapshot: Optional[Snapshot]) -> None:
465-
if Snapshot is None:
466-
raise ValueError("Snapshot cannot be None.")
465+
def _validate(self, current_metadata: TableMetadata, snapshot: Optional[Snapshot]) -> None:
466+
if snapshot is None:
467+
raise CommitFailedException("Snapshot cannot be None.")
467468

468-
if Snapshot.snapshot_id != current_metadata.snapshot_id:
469-
raise ValueError("Operation conflicts are not allowed when performing deleting.")
469+
if snapshot.snapshot_id != current_metadata.snapshot_id:
470+
raise CommitFailedException("Operation conflicts are not allowed when performing deleting.")
470471
return
471472

472473

@@ -498,7 +499,7 @@ def _deleted_entries(self) -> List[ManifestEntry]:
498499
"""
499500
return []
500501

501-
def _validate(self, current_metadata: TableMetadata, Snapshot: Optional[Snapshot]) -> None:
502+
def _validate(self, current_metadata: TableMetadata, snapshot: Optional[Snapshot]) -> None:
502503
"""Other operations don't affect the appending operation, and we can just append."""
503504
return
504505

@@ -630,12 +631,12 @@ def _get_entries(manifest: ManifestFile) -> List[ManifestEntry]:
630631
else:
631632
return []
632633

633-
def _validate(self, current_metadata: TableMetadata, Snapshot: Optional[Snapshot]) -> None:
634-
if Snapshot is None:
635-
raise ValueError("Snapshot cannot be None.")
634+
def _validate(self, current_metadata: TableMetadata, snapshot: Optional[Snapshot]) -> None:
635+
if snapshot is None:
636+
raise CommitFailedException("Snapshot cannot be None.")
636637

637-
if Snapshot.snapshot_id != current_metadata.snapshot_id:
638-
raise ValueError("Operation conflicts are not allowed when performing overwriting.")
638+
if snapshot.snapshot_id != current_metadata.snapshot_id:
639+
raise CommitFailedException("Operation conflicts are not allowed when performing overwriting.")
639640
return
640641

641642

0 commit comments

Comments
 (0)