Skip to content

Commit 54ea690

Browse files
committed
smells
1 parent 2ebff30 commit 54ea690

File tree

6 files changed

+6
-10
lines changed

6 files changed

+6
-10
lines changed

lambdas/ack_backend/src/convert_message_to_ack_row.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
"""Functions for converting the incoming message body into a row of ack data"""
22

3-
from typing import Union
43
from logging_decorators import convert_message_to_ack_row_logging_decorator
54
from update_ack_file import create_ack_data
65

76

8-
def get_error_message_for_ack_file(message_diagnostics) -> Union[None, str]:
7+
def get_error_message_for_ack_file(message_diagnostics) -> None | str:
98
"""Determines and returns the error message to be displayed in the ack file"""
109
if message_diagnostics is None:
1110
return None

lambdas/ack_backend/src/logging_decorators.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
from functools import wraps
88
from common.clients import firehose_client, logger
99

10-
# TODO: can we factor the basic decorator into shared?
11-
1210
STREAM_NAME = os.getenv("SPLUNK_FIREHOSE_NAME", "immunisation-fhir-api-internal-dev-splunk-firehose")
1311

1412

lambdas/ack_backend/src/update_ack_file.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Functions for uploading the data to the ack file"""
22

33
from io import StringIO, BytesIO
4-
from typing import Union, Optional
4+
from typing import Optional
55
from botocore.exceptions import ClientError
66
from constants import ACK_HEADERS, get_source_bucket_name, get_ack_bucket_name
77
from audit_table import change_audit_table_status_to_processed
@@ -15,7 +15,7 @@ def create_ack_data(
1515
local_id: str,
1616
row_id: str,
1717
successful_api_response: bool,
18-
diagnostics: Union[None, str] = None,
18+
diagnostics: None | str = None,
1919
imms_id: str = None,
2020
) -> dict:
2121
"""Returns a dictionary containing the ack headers as keys, along with the relevant values."""

lambdas/ack_backend/tests/test_splunk_logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def test_splunk_logging_missing_data(self):
139139
with self.assertRaises(Exception):
140140
lambda_handler(event={"Records": [{"body": json.dumps([{"": "456"}])}]}, context={})
141141

142-
expected_first_logger_info_data = {**InvalidValues.Logging_with_no_values}
142+
expected_first_logger_info_data = {**InvalidValues.logging_with_no_values}
143143

144144
expected_first_logger_error_data = self.expected_lambda_handler_logs(
145145
success=False, number_of_rows=1, ingestion_complete=False,

lambdas/ack_backend/tests/utils/values_for_ack_backend_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ class InvalidValues:
251251

252252
fixed_datetime = datetime(2024, 10, 29, 12, 0, 0)
253253

254-
Logging_with_no_values = {
254+
logging_with_no_values = {
255255
"function_name": "ack_processor_convert_message_to_ack_row",
256256
"date_time": fixed_datetime.strftime("%Y-%m-%d %H:%M:%S"),
257257
"operation_start_time": "unknown",

lambdas/shared/src/common/models/errors.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import uuid
22
from dataclasses import dataclass
33
from enum import Enum
4-
from typing import Union
54

65

76
class Severity(str, Enum):
@@ -102,7 +101,7 @@ def to_operation_outcome(self) -> dict:
102101
class UnhandledResponseError(RuntimeError):
103102
"""Use this error when the response from an external service (ex: dynamodb) can't be handled"""
104103

105-
response: Union[dict, str]
104+
response: dict | str
106105
message: str
107106

108107
def __str__(self):

0 commit comments

Comments
 (0)