Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions lambdas/mns_publisher/src/process_records.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json
import os
from typing import Tuple

from aws_lambda_typing.events.sqs import SQSMessage

Expand Down Expand Up @@ -68,7 +67,7 @@ def process_record(record: SQSMessage, mns_service: MnsService | MockMnsService)
logger.info("Successfully created MNS notification", extra={"mns_notification_id": notification_id})


def extract_trace_ids(record: SQSMessage) -> Tuple[str, str | None]:
def extract_trace_ids(record: SQSMessage) -> tuple[str, str | None]:
"""
Extract identifiers for tracing from SQS record.
Returns: Tuple of (message_id, immunisation_id)
Expand Down
2 changes: 1 addition & 1 deletion lambdas/mns_publisher/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def load_sample_sqs_event() -> dict:
Expects: lambdas/mns_publisher/tests/sqs_event.json
"""
sample_event_path = Path(__file__).parent / "sample_data" / "sqs_event.json"
with open(sample_event_path, "r") as f:
with open(sample_event_path) as f:
raw_event = json.load(f)

if isinstance(raw_event.get("body"), dict):
Expand Down
6 changes: 2 additions & 4 deletions lambdas/shared/src/common/get_service_url.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
from typing import Optional

from common.constants import DEFAULT_BASE_PATH, PR_ENV_PREFIX


def get_service_url(service_env: Optional[str], service_base_path: Optional[str]) -> str:
def get_service_url(service_env: str | None, service_base_path: str | None) -> str:
"""Sets the service URL based on service parameters derived from env vars. PR environments use internal-dev while
we also default to this environment. The only other exceptions are preprod which maps to the Apigee int environment
and prod which does not have a subdomain."""
Expand All @@ -22,5 +20,5 @@ def get_service_url(service_env: Optional[str], service_base_path: Optional[str]
return f"https://{subdomain}api.service.nhs.uk/{service_base_path}"


def is_pr_env(service_env: Optional[str]) -> bool:
def is_pr_env(service_env: str | None) -> bool:
return service_env is not None and service_env.startswith(PR_ENV_PREFIX)
Loading