Skip to content

Commit

Permalink
Replace try/except/pass with contextlib.suppress
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksonj04 committed Dec 19, 2024
1 parent f9ac2e1 commit d8e8422
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions ds-caselaw-ingester/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import tarfile
import xml.etree.ElementTree as ET
from contextlib import suppress
from urllib.parse import unquote_plus
from uuid import uuid4
from xml.sax.saxutils import escape
Expand Down Expand Up @@ -551,16 +552,14 @@ def save_files_to_s3(self) -> None:
)

# Store parser log
try:
with suppress(FileNotFoundException):
copy_file(
self.tar,
f"{self.consignment_reference}/parser.log",
"parser.log",
self.uri,
s3_client,
)
except FileNotFoundException:
pass

# Store images
image_list = self.metadata["parameters"]["TRE"]["payload"]["images"]
Expand Down

0 comments on commit d8e8422

Please sign in to comment.