diff --git a/backend/src/controller/aws_apig_event_utils.py b/backend/src/controller/aws_apig_event_utils.py index 93d7c93ac..87b6bb05e 100644 --- a/backend/src/controller/aws_apig_event_utils.py +++ b/backend/src/controller/aws_apig_event_utils.py @@ -3,6 +3,7 @@ from typing import Optional from aws_lambda_typing.events import APIGatewayProxyEventV1 + from controller.constants import SUPPLIER_SYSTEM_HEADER_NAME from models.errors import UnauthorizedError from utils import dict_utils diff --git a/backend/src/controller/fhir_controller.py b/backend/src/controller/fhir_controller.py index 2ccdaf4fc..42ee3ad35 100644 --- a/backend/src/controller/fhir_controller.py +++ b/backend/src/controller/fhir_controller.py @@ -8,6 +8,7 @@ from typing import Optional from aws_lambda_typing.events import APIGatewayProxyEventV1 + from controller.aws_apig_event_utils import ( get_path_parameter, get_supplier_system_header, diff --git a/backend/src/forwarding_batch_lambda.py b/backend/src/forwarding_batch_lambda.py index 890a6f8cc..952879da2 100644 --- a/backend/src/forwarding_batch_lambda.py +++ b/backend/src/forwarding_batch_lambda.py @@ -7,6 +7,7 @@ from datetime import datetime import simplejson as json + from batch.batch_filename_to_events_mapper import BatchFilenameToEventsMapper from clients import sqs_client from controller.fhir_batch_controller import ( diff --git a/backend/src/models/fhir_immunization.py b/backend/src/models/fhir_immunization.py index ccb4f9852..1f6e61867 100644 --- a/backend/src/models/fhir_immunization.py +++ b/backend/src/models/fhir_immunization.py @@ -1,6 +1,7 @@ """Immunization FHIR R4B validator""" from fhir.resources.R4B.immunization import Immunization + from models.fhir_immunization_post_validators import PostValidators from models.fhir_immunization_pre_validators import PreValidators from models.utils.validation_utils import get_vaccine_type diff --git a/backend/src/models/utils/generic_utils.py b/backend/src/models/utils/generic_utils.py index 891d0d158..8871e529a 100644 --- a/backend/src/models/utils/generic_utils.py +++ b/backend/src/models/utils/generic_utils.py @@ -15,9 +15,10 @@ BundleLink, ) from fhir.resources.R4B.immunization import Immunization -from models.constants import Constants from stdnum.verhoeff import validate +from models.constants import Constants + def get_contained_resource(imms: dict, resource: Literal["Patient", "Practitioner", "QuestionnaireResponse"]): """Extract and return the requested contained resource from the FHIR Immunization Resource JSON data""" diff --git a/backend/src/parameter_parser.py b/backend/src/parameter_parser.py index f72b1c0ad..9c3db7aeb 100644 --- a/backend/src/parameter_parser.py +++ b/backend/src/parameter_parser.py @@ -5,6 +5,7 @@ from urllib.parse import parse_qs, quote, urlencode from aws_lambda_typing.events import APIGatewayProxyEventV1 + from clients import redis_client from models.constants import Constants from models.errors import ParameterException diff --git a/backend/src/repository/fhir_batch_repository.py b/backend/src/repository/fhir_batch_repository.py index 24e2fd612..f0216c95f 100644 --- a/backend/src/repository/fhir_batch_repository.py +++ b/backend/src/repository/fhir_batch_repository.py @@ -7,6 +7,7 @@ import botocore.exceptions import simplejson as json from boto3.dynamodb.conditions import Attr, Key + from clients import logger from models.errors import ( IdentifierDuplicationError, diff --git a/backend/src/repository/fhir_repository.py b/backend/src/repository/fhir_repository.py index ed8cbd834..72d041534 100644 --- a/backend/src/repository/fhir_repository.py +++ b/backend/src/repository/fhir_repository.py @@ -9,6 +9,9 @@ import simplejson as json from boto3.dynamodb.conditions import Attr, Key from botocore.config import Config +from mypy_boto3_dynamodb.service_resource import DynamoDBServiceResource, Table +from responses import logger + from models.errors import ( IdentifierDuplicationError, ResourceNotFoundError, @@ -18,8 +21,6 @@ check_identifier_system_value, get_vaccine_type, ) -from mypy_boto3_dynamodb.service_resource import DynamoDBServiceResource, Table -from responses import logger def create_table(table_name=None, endpoint_url=None, region_name="eu-west-2"): diff --git a/backend/src/search_imms_handler.py b/backend/src/search_imms_handler.py index f8f275ea7..2a8e50197 100644 --- a/backend/src/search_imms_handler.py +++ b/backend/src/search_imms_handler.py @@ -8,6 +8,7 @@ from aws_lambda_typing import context as context_ from aws_lambda_typing import events + from constants import GENERIC_SERVER_ERROR_DIAGNOSTICS_MESSAGE, MAX_RESPONSE_SIZE_BYTES from controller.aws_apig_response_utils import create_response from controller.fhir_controller import FhirController, make_controller diff --git a/backend/src/service/fhir_batch_service.py b/backend/src/service/fhir_batch_service.py index 48c200840..da0da55d9 100644 --- a/backend/src/service/fhir_batch_service.py +++ b/backend/src/service/fhir_batch_service.py @@ -1,6 +1,7 @@ +from pydantic import ValidationError + from models.errors import CustomValidationError, MandatoryError from models.fhir_immunization import ImmunizationValidator -from pydantic import ValidationError from repository.fhir_batch_repository import ImmunizationBatchRepository IMMUNIZATION_VALIDATOR = ImmunizationValidator() diff --git a/backend/src/service/fhir_service.py b/backend/src/service/fhir_service.py index bc9000278..ba1e07551 100644 --- a/backend/src/service/fhir_service.py +++ b/backend/src/service/fhir_service.py @@ -5,9 +5,6 @@ from typing import Optional, Union from uuid import uuid4 -import parameter_parser -from authorisation.api_operation_code import ApiOperationCode -from authorisation.authoriser import Authoriser from fhir.resources.R4B.bundle import ( Bundle as FhirBundle, ) @@ -17,6 +14,11 @@ BundleLink, ) from fhir.resources.R4B.immunization import Immunization +from pydantic import ValidationError + +import parameter_parser +from authorisation.api_operation_code import ApiOperationCode +from authorisation.authoriser import Authoriser from filter import Filter from models.errors import ( CustomValidationError, @@ -33,7 +35,6 @@ nhs_number_mod11_check, ) from models.utils.validation_utils import get_vaccine_type -from pydantic import ValidationError from repository.fhir_repository import ImmunizationRepository from timer import timed diff --git a/backend/tests/controller/test_fhir_controller.py b/backend/tests/controller/test_fhir_controller.py index 8a7d2ddf1..c65aefb2c 100644 --- a/backend/tests/controller/test_fhir_controller.py +++ b/backend/tests/controller/test_fhir_controller.py @@ -7,10 +7,11 @@ from unittest.mock import ANY, Mock, create_autospec, patch from urllib.parse import urlencode -from controller.aws_apig_response_utils import create_response -from controller.fhir_controller import FhirController from fhir.resources.R4B.bundle import Bundle from fhir.resources.R4B.immunization import Immunization + +from controller.aws_apig_response_utils import create_response +from controller.fhir_controller import FhirController from models.errors import ( CustomValidationError, IdentifierDuplicationError, diff --git a/backend/tests/models/utils/test_generic_utils.py b/backend/tests/models/utils/test_generic_utils.py index 86c4014dd..d8694f754 100644 --- a/backend/tests/models/utils/test_generic_utils.py +++ b/backend/tests/models/utils/test_generic_utils.py @@ -4,6 +4,7 @@ from datetime import date, datetime from src.models.utils.generic_utils import form_json + from testing_utils.generic_utils import format_date_types, load_json_data diff --git a/backend/tests/repository/test_fhir_batch_repository.py b/backend/tests/repository/test_fhir_batch_repository.py index 3f84ae51b..d74227b34 100644 --- a/backend/tests/repository/test_fhir_batch_repository.py +++ b/backend/tests/repository/test_fhir_batch_repository.py @@ -6,13 +6,14 @@ import boto3 import botocore.exceptions import simplejson as json +from moto import mock_aws + from models.errors import ( IdentifierDuplicationError, ResourceFoundError, ResourceNotFoundError, UnhandledResponseError, ) -from moto import mock_aws from repository.fhir_batch_repository import ImmunizationBatchRepository, create_table from testing_utils.immunization_utils import create_covid_19_immunization_dict diff --git a/backend/tests/repository/test_fhir_repository.py b/backend/tests/repository/test_fhir_repository.py index 7cd39b30e..f4a25dd07 100644 --- a/backend/tests/repository/test_fhir_repository.py +++ b/backend/tests/repository/test_fhir_repository.py @@ -6,6 +6,7 @@ import botocore.exceptions import simplejson as json from boto3.dynamodb.conditions import Attr, Key + from models.errors import ( IdentifierDuplicationError, ResourceNotFoundError, diff --git a/backend/tests/service/test_fhir_service.py b/backend/tests/service/test_fhir_service.py index 658046163..01f67a2b1 100644 --- a/backend/tests/service/test_fhir_service.py +++ b/backend/tests/service/test_fhir_service.py @@ -7,12 +7,15 @@ from decimal import Decimal from unittest.mock import MagicMock, create_autospec, patch -from authorisation.api_operation_code import ApiOperationCode -from authorisation.authoriser import Authoriser -from constants import NHS_NUMBER_USED_IN_SAMPLE_DATA from fhir.resources.R4B.bundle import Bundle as FhirBundle from fhir.resources.R4B.bundle import BundleEntry from fhir.resources.R4B.immunization import Immunization +from pydantic import ValidationError +from pydantic.error_wrappers import ErrorWrapper + +from authorisation.api_operation_code import ApiOperationCode +from authorisation.authoriser import Authoriser +from constants import NHS_NUMBER_USED_IN_SAMPLE_DATA from models.errors import ( CustomValidationError, InvalidPatientId, @@ -21,8 +24,6 @@ ) from models.fhir_immunization import ImmunizationValidator from models.utils.generic_utils import get_contained_patient -from pydantic import ValidationError -from pydantic.error_wrappers import ErrorWrapper from repository.fhir_repository import ImmunizationRepository from service.fhir_service import FhirService, UpdateOutcome, get_service_url from testing_utils.generic_utils import load_json_data diff --git a/backend/tests/test_forwarding_batch_lambda.py b/backend/tests/test_forwarding_batch_lambda.py index d1bcb294b..8647cfb31 100644 --- a/backend/tests/test_forwarding_batch_lambda.py +++ b/backend/tests/test_forwarding_batch_lambda.py @@ -8,6 +8,8 @@ from unittest.mock import ANY, MagicMock, patch from boto3 import resource as boto3_resource +from moto import mock_aws + from models.errors import ( CustomValidationError, IdentifierDuplicationError, @@ -16,7 +18,6 @@ ResourceFoundError, ResourceNotFoundError, ) -from moto import mock_aws from testing_utils.test_utils_for_batch import ForwarderValues, MockFhirImmsResources with patch.dict("os.environ", ForwarderValues.MOCK_ENVIRONMENT_DICT): diff --git a/backend/tests/test_immunization_post_validator.py b/backend/tests/test_immunization_post_validator.py index fea868789..8ce175dea 100644 --- a/backend/tests/test_immunization_post_validator.py +++ b/backend/tests/test_immunization_post_validator.py @@ -5,8 +5,9 @@ from unittest.mock import patch from jsonpath_ng.ext import parse -from models.fhir_immunization import ImmunizationValidator from pydantic import ValidationError + +from models.fhir_immunization import ImmunizationValidator from testing_utils.generic_utils import ( load_json_data, update_contained_resource_field, diff --git a/backend/tests/test_immunization_pre_validator.py b/backend/tests/test_immunization_pre_validator.py index 1bafd2994..704bb6832 100644 --- a/backend/tests/test_immunization_pre_validator.py +++ b/backend/tests/test_immunization_pre_validator.py @@ -6,6 +6,7 @@ from unittest.mock import patch from jsonpath_ng.ext import parse + from models.fhir_immunization import ImmunizationValidator from models.fhir_immunization_pre_validators import PreValidators from models.utils.generic_utils import ( diff --git a/backend/tests/test_validation_utils.py b/backend/tests/test_validation_utils.py index d8e3c730e..d1b3ab2a0 100644 --- a/backend/tests/test_validation_utils.py +++ b/backend/tests/test_validation_utils.py @@ -2,6 +2,7 @@ from copy import deepcopy from jsonpath_ng.ext import parse + from models.fhir_immunization import ImmunizationValidator from models.obtain_field_value import ObtainFieldValue from models.utils.generic_utils import ( diff --git a/backend/tests/testing_utils/immunization_utils.py b/backend/tests/testing_utils/immunization_utils.py index cd69b1ba8..1a1f1a42d 100644 --- a/backend/tests/testing_utils/immunization_utils.py +++ b/backend/tests/testing_utils/immunization_utils.py @@ -1,6 +1,7 @@ """Immunization utils.""" from fhir.resources.R4B.immunization import Immunization + from testing_utils.generic_utils import load_json_data from testing_utils.values_for_tests import ValidValues diff --git a/batch_processor_filter/src/batch_audit_repository.py b/batch_processor_filter/src/batch_audit_repository.py index f3e15e751..24bac0a72 100644 --- a/batch_processor_filter/src/batch_audit_repository.py +++ b/batch_processor_filter/src/batch_audit_repository.py @@ -1,5 +1,6 @@ import boto3 from boto3.dynamodb.conditions import Key + from constants import ( AUDIT_TABLE_FILENAME_GSI, AUDIT_TABLE_NAME, diff --git a/batch_processor_filter/src/batch_file_repository.py b/batch_processor_filter/src/batch_file_repository.py index e30746cbb..9d5f2a349 100644 --- a/batch_processor_filter/src/batch_file_repository.py +++ b/batch_processor_filter/src/batch_file_repository.py @@ -4,6 +4,7 @@ from io import BytesIO, StringIO import boto3 + from batch_file_created_event import BatchFileCreatedEvent from constants import ACK_BUCKET_NAME, SOURCE_BUCKET_NAME diff --git a/batch_processor_filter/src/batch_processor_filter_service.py b/batch_processor_filter/src/batch_processor_filter_service.py index 988e652b1..236030dfb 100644 --- a/batch_processor_filter/src/batch_processor_filter_service.py +++ b/batch_processor_filter/src/batch_processor_filter_service.py @@ -3,6 +3,7 @@ import json import boto3 + from batch_audit_repository import BatchAuditRepository from batch_file_created_event import BatchFileCreatedEvent from batch_file_repository import BatchFileRepository diff --git a/batch_processor_filter/src/lambda_handler.py b/batch_processor_filter/src/lambda_handler.py index 0ba0ca202..d00a659ae 100644 --- a/batch_processor_filter/src/lambda_handler.py +++ b/batch_processor_filter/src/lambda_handler.py @@ -1,6 +1,7 @@ import json from aws_lambda_typing import context, events + from batch_file_created_event import BatchFileCreatedEvent from batch_processor_filter_service import BatchProcessorFilterService from exception_decorator import exception_decorator diff --git a/batch_processor_filter/src/send_log_to_firehose.py b/batch_processor_filter/src/send_log_to_firehose.py index be04327b7..86de3cd75 100644 --- a/batch_processor_filter/src/send_log_to_firehose.py +++ b/batch_processor_filter/src/send_log_to_firehose.py @@ -1,6 +1,7 @@ import json import boto3 + from constants import REGION_NAME, SPLUNK_FIREHOSE_STREAM_NAME firehose_client = boto3.client("firehose", region_name=REGION_NAME) diff --git a/batch_processor_filter/tests/test_lambda_handler.py b/batch_processor_filter/tests/test_lambda_handler.py index 69a35b90b..91201190f 100644 --- a/batch_processor_filter/tests/test_lambda_handler.py +++ b/batch_processor_filter/tests/test_lambda_handler.py @@ -6,12 +6,13 @@ import boto3 import botocore +from moto import mock_aws + from batch_file_created_event import BatchFileCreatedEvent from exceptions import ( EventAlreadyProcessingForSupplierAndVaccTypeError, InvalidBatchSizeError, ) -from moto import mock_aws from testing_utils import ( MOCK_ENVIRONMENT_DICT, add_entry_to_mock_table, diff --git a/batch_processor_filter/tests/testing_utils.py b/batch_processor_filter/tests/testing_utils.py index bae2a8201..3f1a471d4 100644 --- a/batch_processor_filter/tests/testing_utils.py +++ b/batch_processor_filter/tests/testing_utils.py @@ -1,6 +1,7 @@ import json from aws_lambda_typing.events.sqs import SQSMessage + from batch_file_created_event import BatchFileCreatedEvent MOCK_ENVIRONMENT_DICT = { diff --git a/delta_backend/src/delta.py b/delta_backend/src/delta.py index 4c2eebddf..a601e1252 100644 --- a/delta_backend/src/delta.py +++ b/delta_backend/src/delta.py @@ -8,6 +8,7 @@ import boto3 from boto3.dynamodb.conditions import Attr from botocore.exceptions import ClientError + from common.mappings import ActionFlag, EventName, Operation from converter import Converter from log_firehose import FirehoseLogger diff --git a/delta_backend/tests/test_convert.py b/delta_backend/tests/test_convert.py index 6eaaca3cb..b743116b7 100644 --- a/delta_backend/tests/test_convert.py +++ b/delta_backend/tests/test_convert.py @@ -6,8 +6,9 @@ from unittest.mock import patch from boto3 import resource as boto3_resource -from common.mappings import ActionFlag, EventName, Operation from moto import mock_aws + +from common.mappings import ActionFlag, EventName, Operation from utils_for_converter_tests import ErrorValuesForTests, ValuesForTests MOCK_ENV_VARS = { diff --git a/delta_backend/tests/test_delta.py b/delta_backend/tests/test_delta.py index 7df127c7f..1152f8a92 100644 --- a/delta_backend/tests/test_delta.py +++ b/delta_backend/tests/test_delta.py @@ -4,8 +4,9 @@ import unittest from unittest.mock import MagicMock, patch -import delta from botocore.exceptions import ClientError + +import delta from common.mappings import ActionFlag, EventName, Operation from delta import ( handler, diff --git a/e2e_batch/clients.py b/e2e_batch/clients.py index 3198df763..2411622e0 100644 --- a/e2e_batch/clients.py +++ b/e2e_batch/clients.py @@ -6,6 +6,7 @@ from boto3 import client as boto3_client from boto3 import resource as boto3_resource + from constants import ( REGION, ack_metadata_queue_name, diff --git a/e2e_batch/scenarios.py b/e2e_batch/scenarios.py index 50789049b..b89864406 100644 --- a/e2e_batch/scenarios.py +++ b/e2e_batch/scenarios.py @@ -3,6 +3,8 @@ from datetime import datetime, timezone import pandas as pd +from vax_suppliers import OdsVax, TestPair + from clients import logger from constants import ( ACK_BUCKET, @@ -22,7 +24,6 @@ poll_s3_file_pattern, validate_fatal_error, ) -from vax_suppliers import OdsVax, TestPair class TestAction: diff --git a/e2e_batch/test_e2e_batch.py b/e2e_batch/test_e2e_batch.py index 963e9d93a..b4ca5394d 100644 --- a/e2e_batch/test_e2e_batch.py +++ b/e2e_batch/test_e2e_batch.py @@ -1,6 +1,14 @@ import time import unittest +from scenarios import ( + TestCase, + create_test_cases, + enable_tests, + generate_csv_files, + scenarios, +) + from clients import logger from constants import ( ACK_BUCKET, @@ -10,13 +18,6 @@ DestinationType, environment, ) -from scenarios import ( - TestCase, - create_test_cases, - enable_tests, - generate_csv_files, - scenarios, -) from utils import ( check_ack_file_content, delete_file_from_s3, diff --git a/e2e_batch/utils.py b/e2e_batch/utils.py index e057075a3..bb95bf69a 100644 --- a/e2e_batch/utils.py +++ b/e2e_batch/utils.py @@ -11,6 +11,7 @@ import pandas as pd from boto3.dynamodb.conditions import Key from botocore.exceptions import ClientError + from clients import ( ack_metadata_queue_url, audit_table, diff --git a/lambdas/ack_backend/src/update_ack_file.py b/lambdas/ack_backend/src/update_ack_file.py index f1b70d866..0407fe29f 100644 --- a/lambdas/ack_backend/src/update_ack_file.py +++ b/lambdas/ack_backend/src/update_ack_file.py @@ -2,8 +2,9 @@ from io import BytesIO, StringIO -from audit_table import change_audit_table_status_to_processed from botocore.exceptions import ClientError + +from audit_table import change_audit_table_status_to_processed from common.clients import get_s3_client, logger from constants import ( ACK_HEADERS, diff --git a/lambdas/ack_backend/tests/test_ack_processor.py b/lambdas/ack_backend/tests/test_ack_processor.py index 21cf93939..987e05c07 100644 --- a/lambdas/ack_backend/tests/test_ack_processor.py +++ b/lambdas/ack_backend/tests/test_ack_processor.py @@ -8,6 +8,7 @@ from boto3 import client as boto3_client from moto import mock_aws + from utils.generic_setup_and_teardown_for_ack_backend import ( GenericSetUp, GenericTearDown, diff --git a/lambdas/ack_backend/tests/test_update_ack_file.py b/lambdas/ack_backend/tests/test_update_ack_file.py index 398947952..fdbefaf89 100644 --- a/lambdas/ack_backend/tests/test_update_ack_file.py +++ b/lambdas/ack_backend/tests/test_update_ack_file.py @@ -7,6 +7,7 @@ from boto3 import client as boto3_client from moto import mock_aws + from utils.generic_setup_and_teardown_for_ack_backend import ( GenericSetUp, GenericTearDown, diff --git a/lambdas/ack_backend/tests/test_update_ack_file_flow.py b/lambdas/ack_backend/tests/test_update_ack_file_flow.py index a613436ab..cde99e2aa 100644 --- a/lambdas/ack_backend/tests/test_update_ack_file_flow.py +++ b/lambdas/ack_backend/tests/test_update_ack_file_flow.py @@ -2,9 +2,10 @@ from unittest.mock import patch import boto3 -import update_ack_file from moto import mock_aws +import update_ack_file + @mock_aws class TestUpdateAckFileFlow(unittest.TestCase): diff --git a/lambdas/ack_backend/tests/utils/generic_setup_and_teardown_for_ack_backend.py b/lambdas/ack_backend/tests/utils/generic_setup_and_teardown_for_ack_backend.py index 164bd7cd0..afb815631 100644 --- a/lambdas/ack_backend/tests/utils/generic_setup_and_teardown_for_ack_backend.py +++ b/lambdas/ack_backend/tests/utils/generic_setup_and_teardown_for_ack_backend.py @@ -1,7 +1,6 @@ """Generic setup and teardown for ACK backend tests""" from constants import AuditTableKeys - from tests.utils.mock_environment_variables import AUDIT_TABLE_NAME, REGION_NAME, BucketNames, Firehose diff --git a/lambdas/id_sync/src/ieds_db_operations.py b/lambdas/id_sync/src/ieds_db_operations.py index fd88a25cb..1beed46d1 100644 --- a/lambdas/id_sync/src/ieds_db_operations.py +++ b/lambdas/id_sync/src/ieds_db_operations.py @@ -1,6 +1,7 @@ import json from boto3.dynamodb.conditions import Key + from common.aws_dynamodb import get_dynamodb_table from common.clients import dynamodb_client, logger from exceptions.id_sync_exception import IdSyncException diff --git a/lambdas/mns_subscription/src/mns_service.py b/lambdas/mns_subscription/src/mns_service.py index 7a6eee6bf..3ffa38298 100644 --- a/lambdas/mns_subscription/src/mns_service.py +++ b/lambdas/mns_subscription/src/mns_service.py @@ -4,6 +4,7 @@ import uuid import requests + from common.authentication import AppRestrictedAuth from common.models.errors import ( BadRequestError, diff --git a/lambdas/mns_subscription/src/mns_setup.py b/lambdas/mns_subscription/src/mns_setup.py index ea39e3642..422661a90 100644 --- a/lambdas/mns_subscription/src/mns_setup.py +++ b/lambdas/mns_subscription/src/mns_setup.py @@ -2,6 +2,7 @@ import boto3 from botocore.config import Config + from common.authentication import AppRestrictedAuth, Service from common.cache import Cache from mns_service import MnsService diff --git a/lambdas/shared/src/common/authentication.py b/lambdas/shared/src/common/authentication.py index 16b900439..a9fc89a88 100644 --- a/lambdas/shared/src/common/authentication.py +++ b/lambdas/shared/src/common/authentication.py @@ -6,6 +6,7 @@ import jwt import requests + from common.clients import logger from common.models.errors import UnhandledResponseError diff --git a/lambdas/shared/src/common/pds_service.py b/lambdas/shared/src/common/pds_service.py index 78c6d0a2c..9c9c39db3 100644 --- a/lambdas/shared/src/common/pds_service.py +++ b/lambdas/shared/src/common/pds_service.py @@ -1,6 +1,7 @@ import uuid import requests + from common.authentication import AppRestrictedAuth from common.clients import logger from common.models.errors import UnhandledResponseError diff --git a/lambdas/shared/src/common/redis_client.py b/lambdas/shared/src/common/redis_client.py index 87ae876f0..07c0c9e60 100644 --- a/lambdas/shared/src/common/redis_client.py +++ b/lambdas/shared/src/common/redis_client.py @@ -1,6 +1,7 @@ import os import redis + from common.clients import logger REDIS_HOST = os.getenv("REDIS_HOST", "") diff --git a/lambdas/shared/tests/test_common/test_authentication.py b/lambdas/shared/tests/test_common/test_authentication.py index 44c956d24..de31eda96 100644 --- a/lambdas/shared/tests/test_common/test_authentication.py +++ b/lambdas/shared/tests/test_common/test_authentication.py @@ -5,9 +5,10 @@ from unittest.mock import ANY, MagicMock, patch import responses +from responses import matchers + from common.authentication import AppRestrictedAuth, Service from common.models.errors import UnhandledResponseError -from responses import matchers class TestAuthenticator(unittest.TestCase): diff --git a/lambdas/shared/tests/test_common/test_pds_service.py b/lambdas/shared/tests/test_common/test_pds_service.py index ebe22063c..2d1a4bdfd 100644 --- a/lambdas/shared/tests/test_common/test_pds_service.py +++ b/lambdas/shared/tests/test_common/test_pds_service.py @@ -2,10 +2,11 @@ from unittest.mock import create_autospec import responses +from responses import matchers + from common.authentication import AppRestrictedAuth from common.models.errors import UnhandledResponseError from common.pds_service import PdsService -from responses import matchers class TestPdsService(unittest.TestCase): diff --git a/recordprocessor/src/send_to_kinesis.py b/recordprocessor/src/send_to_kinesis.py index 2184d499e..b8304584c 100644 --- a/recordprocessor/src/send_to_kinesis.py +++ b/recordprocessor/src/send_to_kinesis.py @@ -4,6 +4,7 @@ import simplejson as json from botocore.exceptions import ClientError + from clients import kinesis_client, logger diff --git a/recordprocessor/tests/test_audit_table.py b/recordprocessor/tests/test_audit_table.py index 85e7d5cf7..92b6d0909 100644 --- a/recordprocessor/tests/test_audit_table.py +++ b/recordprocessor/tests/test_audit_table.py @@ -5,9 +5,9 @@ from unittest.mock import patch from boto3 import client as boto3_client -from errors import UnhandledAuditTableError from moto import mock_dynamodb +from errors import UnhandledAuditTableError from tests.utils_for_recordprocessor_tests.generic_setup_and_teardown import ( GenericSetUp, GenericTearDown, diff --git a/recordprocessor/tests/test_recordprocessor_edge_cases.py b/recordprocessor/tests/test_recordprocessor_edge_cases.py index 7bde32bb1..41a39e4a5 100644 --- a/recordprocessor/tests/test_recordprocessor_edge_cases.py +++ b/recordprocessor/tests/test_recordprocessor_edge_cases.py @@ -4,7 +4,6 @@ from unittest.mock import call, patch from batch_processor import process_csv_to_fhir - from tests.utils_for_recordprocessor_tests.utils_for_recordprocessor_tests import ( create_patch, ) diff --git a/recordprocessor/tests/test_recordprocessor_main.py b/recordprocessor/tests/test_recordprocessor_main.py index 0d557b75b..6ce76eec0 100644 --- a/recordprocessor/tests/test_recordprocessor_main.py +++ b/recordprocessor/tests/test_recordprocessor_main.py @@ -9,6 +9,7 @@ from boto3 import client as boto3_client from moto import mock_dynamodb, mock_firehose, mock_kinesis, mock_s3 + from utils_for_recordprocessor_tests.mock_environment_variables import ( MOCK_ENVIRONMENT_DICT, BucketNames, diff --git a/recordprocessor/tests/utils_for_recordprocessor_tests/utils_for_recordprocessor_tests.py b/recordprocessor/tests/utils_for_recordprocessor_tests/utils_for_recordprocessor_tests.py index ce7ced903..2d8d0aa26 100644 --- a/recordprocessor/tests/utils_for_recordprocessor_tests/utils_for_recordprocessor_tests.py +++ b/recordprocessor/tests/utils_for_recordprocessor_tests/utils_for_recordprocessor_tests.py @@ -6,6 +6,7 @@ from boto3 import client as boto3_client from boto3.dynamodb.types import TypeDeserializer + from utils_for_recordprocessor_tests.mock_environment_variables import ( MOCK_ENVIRONMENT_DICT, BucketNames, diff --git a/ruff.toml b/ruff.toml index ecb080d4d..c14df56ac 100644 --- a/ruff.toml +++ b/ruff.toml @@ -1,5 +1,6 @@ line-length = 121 target-version = "py311" +src = ["**/src", "**/tests"] [lint] # TODO - consider enabling more rulesets, e.g. B, C90, N, RET, S, UP