From 67667fb97daba767d47701177a5a911e00c910bd Mon Sep 17 00:00:00 2001 From: Andy Rae Date: Thu, 28 Mar 2024 15:21:29 +0000 Subject: [PATCH 1/2] Fix return empty data dict --- app/workers/shared_code/blob_parser.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/workers/shared_code/blob_parser.py b/app/workers/shared_code/blob_parser.py index afc0d19b1..27badcb1e 100644 --- a/app/workers/shared_code/blob_parser.py +++ b/app/workers/shared_code/blob_parser.py @@ -2,7 +2,7 @@ import logging import os from io import BytesIO -from typing import Any, Dict, List, Tuple +from typing import Any, Dict, List, Optional, Tuple import openpyxl from azure.storage.blob import BlobServiceClient @@ -123,7 +123,7 @@ def get_scan_report(blob: str) -> openpyxl.Workbook: def get_data_dictionary( blob: str, -) -> Tuple[Dict[str, Dict[str, Any]], Dict[str, Dict[str, Any]]]: +) -> Tuple[Optional[Dict[str, Dict[str, Any]]], Optional[Dict[str, Dict[str, Any]]]]: """ Retrieves the data dictionary and vocabulary dictionary from a blob storage. @@ -131,8 +131,10 @@ def get_data_dictionary( blob (str): The name of the blob containing the data dictionary. Returns: - Tuple[Dict[Any, Any], Dict[Any, Any]]: A tuple containing the data dictionary and vocabulary dictionary. + Tuple[Optional[Dict[str, Dict[str, Any]]], Optional[Dict[str, Dict[str, Any]]]]: A tuple containing the data dictionary and vocabulary dictionary. """ + if blob == "None": + return None, None # Set Storage Account connection string blob_service_client = BlobServiceClient.from_connection_string( From 45dd3651c0026f8de46ad5f13fba18d8d2879a34 Mon Sep 17 00:00:00 2001 From: Andy Rae Date: Thu, 28 Mar 2024 15:24:08 +0000 Subject: [PATCH 2/2] Fix failure enum --- app/workers/shared_code/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/workers/shared_code/api.py b/app/workers/shared_code/api.py index cda6b3c38..83bcbb7c1 100644 --- a/app/workers/shared_code/api.py +++ b/app/workers/shared_code/api.py @@ -24,7 +24,7 @@ class ScanReportStatus(Enum): UPLOAD_IN_PROGRESS = "UPINPRO" UPLOAD_COMPLETE = "UPCOMPL" - UPLOAD_FAILED = "UPFAIL" + UPLOAD_FAILED = "UPFAILE" PENDING = "PENDING" COMPLETE = "COMPLET"