Skip to content

Commit f7e8b19

Browse files
committed
fix linting errors
1 parent bc01678 commit f7e8b19

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/webapp/gcsutil.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from .validation import validate_file_reader
1111
from typing import Any, List, Optional, Dict
1212
import logging
13-
from datetime import datetime, timezone
1413

1514
# Set the logging
1615
logging.basicConfig(format="%(asctime)s [%(levelname)s]: %(message)s")
@@ -276,7 +275,7 @@ def delete_batch_files(
276275

277276
prefix = "validated/"
278277

279-
now_iso = lambda: datetime.now(timezone.utc).isoformat()
278+
now_iso = datetime.datetime.now()
280279
deleted: List[Dict[str, str]] = []
281280
not_found: List[str] = []
282281
errors: List[Dict[str, str]] = []
@@ -293,8 +292,8 @@ def delete_batch_files(
293292
self.delete_file(bucket_name=bucket_name, file_name=blob_path)
294293
logger.info("Delete successful: gs://%s/%s", bucket_name, blob_path)
295294
deleted.append({"file": fname, "path": blob_path, "deleted_at": now_iso()})
296-
except Exception as e:
297-
logger.warning("Blob not found: gs://%s/%s", bucket_name, blob_path)
295+
except ValueError:
296+
logger.warning("Blob or bucket not found: gs://%s/%s", bucket_name, blob_path)
298297
not_found.append(fname)
299298
except Exception as e: # network/other unexpected errors
300299
logger.exception("Unexpected error deleting gs://%s/%s", bucket_name, blob_path)

0 commit comments

Comments
 (0)