From d8e8422c13f19733be94f06026f97a4a0279683a Mon Sep 17 00:00:00 2001 From: Nick Jackson Date: Thu, 19 Dec 2024 13:38:02 +0000 Subject: [PATCH] Replace try/except/pass with contextlib.suppress --- ds-caselaw-ingester/lambda_function.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ds-caselaw-ingester/lambda_function.py b/ds-caselaw-ingester/lambda_function.py index 62f86eb..b80fc53 100644 --- a/ds-caselaw-ingester/lambda_function.py +++ b/ds-caselaw-ingester/lambda_function.py @@ -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 @@ -551,7 +552,7 @@ def save_files_to_s3(self) -> None: ) # Store parser log - try: + with suppress(FileNotFoundException): copy_file( self.tar, f"{self.consignment_reference}/parser.log", @@ -559,8 +560,6 @@ def save_files_to_s3(self) -> None: self.uri, s3_client, ) - except FileNotFoundException: - pass # Store images image_list = self.metadata["parameters"]["TRE"]["payload"]["images"]