From 821d9dc8632d674582e26829eb0301b5b7ba12bb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 29 Mar 2026 11:05:07 +0000 Subject: [PATCH] fix: apply black formatting to reports.py and dmarc_parser.py Agent-Logs-Url: https://github.com/christianlouis/dmarq/sessions/b108ee4f-3479-43fa-a9e9-23a697718aa3 Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> --- backend/app/api/api_v1/endpoints/reports.py | 12 +++--------- backend/app/services/dmarc_parser.py | 4 +--- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/backend/app/api/api_v1/endpoints/reports.py b/backend/app/api/api_v1/endpoints/reports.py index 70f5cf5..419c6c1 100644 --- a/backend/app/api/api_v1/endpoints/reports.py +++ b/backend/app/api/api_v1/endpoints/reports.py @@ -66,9 +66,7 @@ def _validate_upload_file(file: UploadFile, file_content: bytes) -> None: """ # Security: Validate filename is provided if not file.filename: - raise HTTPException( - status_code=status.HTTP_400_BAD_REQUEST, detail="Filename is required" - ) + raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="Filename is required") # Security: Validate file extension file_ext = "." + file.filename.rsplit(".", 1)[-1].lower() if "." in file.filename else "" @@ -97,13 +95,9 @@ def _handle_upload_value_error(filename: str, error_message: str) -> None: status_code=status.HTTP_413_REQUEST_ENTITY_TOO_LARGE, detail="File too large" ) elif "zip bomb" in error_message.lower(): - raise HTTPException( - status_code=status.HTTP_400_BAD_REQUEST, detail="Invalid archive file" - ) + raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="Invalid archive file") else: - raise HTTPException( - status_code=status.HTTP_400_BAD_REQUEST, detail="Invalid report format" - ) + raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST, detail="Invalid report format") class UploadResponse(BaseModel): diff --git a/backend/app/services/dmarc_parser.py b/backend/app/services/dmarc_parser.py index 73ba7b9..c5944f2 100644 --- a/backend/app/services/dmarc_parser.py +++ b/backend/app/services/dmarc_parser.py @@ -237,9 +237,7 @@ class DMARCParser: # Log parse results for debugging total_count = report["summary"]["total_count"] logger.info(f"Parsed DMARC report for domain: {report.get('domain')}") - logger.info( - f"Found {len(records)} record entries with {total_count} total messages" - ) + logger.info(f"Found {len(records)} record entries with {total_count} total messages") logger.info( f"Messages passed: {report['summary']['passed_count']}, " f"failed: {report['summary']['failed_count']}"