24 lines
667 B
Python
24 lines
667 B
Python
"""Common utility helpers for the server package."""
|
|
from __future__ import annotations
|
|
|
|
import uuid
|
|
from typing import Iterable, List
|
|
|
|
|
|
def normalize_recipients(value: str | None) -> List[str]:
|
|
"""Split a comma separated string of emails into a clean list."""
|
|
if not value:
|
|
return []
|
|
return [item.strip() for item in value.split(",") if item.strip()]
|
|
|
|
|
|
def is_valid_email(value: str) -> bool:
|
|
"""Perform a very small sanity check for email addresses."""
|
|
value = value.strip()
|
|
return bool(value and "@" in value)
|
|
|
|
|
|
def generate_request_id() -> str:
|
|
"""Return a UUID4 string for request correlation."""
|
|
return str(uuid.uuid4())
|