Skip to content

Commit

Permalink
Replace asserts with boolean logic chaining
Browse files Browse the repository at this point in the history
  • Loading branch information
JBorrow committed Dec 5, 2024
1 parent 4b9b837 commit 686d755
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions librarian_background/rolling_deletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ def core(self, session: Session):
return False

# Check that we got what we wanted.
try:
assert instance.created_time.replace(tzinfo=timezone.utc) < age_cutoff
assert instance.store_id == store.id
assert instance.available
except AssertionError:
valid_time = instance.created_time.replace(tzinfo=timezone.utc) < age_cutoff
valid_store = instance.store_id == store.id
all_ok = valid_time and valid_store and instance.available

if not all_ok:
logger.error(
"Instance {} does not meet the criteria, skipping", instance.id
)
Expand Down

0 comments on commit 686d755

Please sign in to comment.