From 146125044b44def0ebecdd123dc2d9edb8a8b754 Mon Sep 17 00:00:00 2001 From: Tanya Borisova Date: Tue, 9 Apr 2024 22:07:20 +0000 Subject: [PATCH] Fix imports --- code/backend/batch/AddURLEmbeddings.py | 7 ++++--- code/backend/batch/BatchPushResults.py | 9 +++++---- code/backend/batch/BatchStartProcessing.py | 8 +++++--- code/backend/batch/GetConversationResponse.py | 10 ++++++---- code/tests/test_AddURLEmbeddings.py | 6 +++++- code/tests/test_BatchGetConversationResponse.py | 7 ++++++- code/tests/test_BatchPushResults.py | 7 +++++-- code/tests/test_BatchStartProcessing.py | 4 +++- 8 files changed, 39 insertions(+), 19 deletions(-) diff --git a/code/backend/batch/AddURLEmbeddings.py b/code/backend/batch/AddURLEmbeddings.py index de7e19329..f1b717a05 100644 --- a/code/backend/batch/AddURLEmbeddings.py +++ b/code/backend/batch/AddURLEmbeddings.py @@ -1,13 +1,14 @@ import logging import traceback import azure.functions as func +import sys -from backend.batch.utilities.helpers.DocumentProcessorHelper import DocumentProcessor -from backend.batch.utilities.helpers.ConfigHelper import ConfigHelper +from utilities.helpers.DocumentProcessorHelper import DocumentProcessor +from utilities.helpers.ConfigHelper import ConfigHelper +sys.path.append("..") bp_add_url_embeddings = func.Blueprint() - logger = logging.getLogger(__name__) diff --git a/code/backend/batch/BatchPushResults.py b/code/backend/batch/BatchPushResults.py index 056f2835f..db1af768d 100644 --- a/code/backend/batch/BatchPushResults.py +++ b/code/backend/batch/BatchPushResults.py @@ -2,16 +2,17 @@ import json import azure.functions as func from urllib.parse import urlparse +import sys -from backend.batch.utilities.helpers.AzureBlobStorageHelper import ( +from utilities.helpers.AzureBlobStorageHelper import ( AzureBlobStorageClient, ) -from backend.batch.utilities.helpers.DocumentProcessorHelper import DocumentProcessor -from backend.batch.utilities.helpers.ConfigHelper import ConfigHelper +from utilities.helpers.DocumentProcessorHelper import DocumentProcessor +from utilities.helpers.ConfigHelper import ConfigHelper +sys.path.append("..") bp_batch_push_results = func.Blueprint() - logger = logging.getLogger(__name__) diff --git a/code/backend/batch/BatchStartProcessing.py b/code/backend/batch/BatchStartProcessing.py index ec5816f7e..a389f69ca 100644 --- a/code/backend/batch/BatchStartProcessing.py +++ b/code/backend/batch/BatchStartProcessing.py @@ -1,16 +1,18 @@ import logging import json import azure.functions as func -from backend.batch.utilities.helpers.EnvHelper import EnvHelper -from backend.batch.utilities.helpers.AzureBlobStorageHelper import ( +import sys + +from utilities.helpers.EnvHelper import EnvHelper +from utilities.helpers.AzureBlobStorageHelper import ( AzureBlobStorageClient, create_queue_client, ) bp_batch_start_processing = func.Blueprint() env_helper: EnvHelper = EnvHelper() - logger = logging.getLogger(__name__) +sys.path.append("..") @bp_batch_start_processing.route(route="BatchStartProcessing") diff --git a/code/backend/batch/GetConversationResponse.py b/code/backend/batch/GetConversationResponse.py index 6ae6d37ee..326f61b12 100644 --- a/code/backend/batch/GetConversationResponse.py +++ b/code/backend/batch/GetConversationResponse.py @@ -1,14 +1,16 @@ import azure.functions as func import logging import json -from backend.batch.utilities.helpers.EnvHelper import EnvHelper -from backend.batch.utilities.helpers.OrchestratorHelper import Orchestrator -from backend.batch.utilities.helpers.ConfigHelper import ConfigHelper +import sys +from utilities.helpers.EnvHelper import EnvHelper +from utilities.helpers.OrchestratorHelper import Orchestrator +from utilities.helpers.ConfigHelper import ConfigHelper + +sys.path.append("..") bp_get_conversation_response = func.Blueprint() env_helper: EnvHelper = EnvHelper() - logger = logging.getLogger(__name__) diff --git a/code/tests/test_AddURLEmbeddings.py b/code/tests/test_AddURLEmbeddings.py index 617f28e58..63398a519 100644 --- a/code/tests/test_AddURLEmbeddings.py +++ b/code/tests/test_AddURLEmbeddings.py @@ -1,6 +1,10 @@ +import sys from unittest import mock import azure.functions as func -from backend.batch.AddURLEmbeddings import do_add_url_embeddings + +sys.path.append("backend/batch") + +from backend.batch.AddURLEmbeddings import do_add_url_embeddings # noqa: E402 @mock.patch("backend.batch.AddURLEmbeddings.DocumentProcessor") diff --git a/code/tests/test_BatchGetConversationResponse.py b/code/tests/test_BatchGetConversationResponse.py index a15dfc73b..f8a755310 100644 --- a/code/tests/test_BatchGetConversationResponse.py +++ b/code/tests/test_BatchGetConversationResponse.py @@ -1,7 +1,12 @@ +import sys from unittest.mock import patch, Mock, ANY import json -from backend.batch.GetConversationResponse import do_get_conversation_response +sys.path.append("backend/batch/") + +from backend.batch.GetConversationResponse import ( # noqa: E402 + do_get_conversation_response, +) @patch("backend.batch.GetConversationResponse.Orchestrator") diff --git a/code/tests/test_BatchPushResults.py b/code/tests/test_BatchPushResults.py index 3e0c51c01..e38e82bbb 100644 --- a/code/tests/test_BatchPushResults.py +++ b/code/tests/test_BatchPushResults.py @@ -1,7 +1,10 @@ +import sys from unittest.mock import patch, Mock from azure.functions import QueueMessage -from backend.batch.BatchPushResults import do_batch_push_results -from backend.batch.BatchPushResults import _get_file_name_from_message + +sys.path.append("backend/batch/") +from backend.batch.BatchPushResults import do_batch_push_results # noqa: E402 +from backend.batch.BatchPushResults import _get_file_name_from_message # noqa: E402 def test_get_file_name_from_message(): diff --git a/code/tests/test_BatchStartProcessing.py b/code/tests/test_BatchStartProcessing.py index 3c24936ae..4fb953831 100644 --- a/code/tests/test_BatchStartProcessing.py +++ b/code/tests/test_BatchStartProcessing.py @@ -1,6 +1,8 @@ +import sys from unittest.mock import patch, Mock -from backend.batch.BatchStartProcessing import do_batch_start_processing +sys.path.append("backend/batch") +from backend.batch.BatchStartProcessing import do_batch_start_processing # noqa: E402 @patch("backend.batch.BatchStartProcessing.create_queue_client")