From 85b10c38f39732421a230d938adddc7805d0e001 Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Mon, 16 Nov 2026 09:27:29 +0100 Subject: style(core): reorder module declarations Group globals and data classes near module imports, keep primary classes and functions together, and move implementation helpers after their public callers. Reorder Alembic setup so configuration happens after the required helpers are defined, without changing runtime behavior. --- webmentions_ssg/tasks/sender.py | 56 ++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'webmentions_ssg/tasks/sender.py') diff --git a/webmentions_ssg/tasks/sender.py b/webmentions_ssg/tasks/sender.py index 3f64bed..6b14ace 100644 --- a/webmentions_ssg/tasks/sender.py +++ b/webmentions_ssg/tasks/sender.py @@ -32,6 +32,34 @@ from .endpoint_discovery import ( ) +@dataclass(frozen=True) +class ClaimedSendAttempt: + """Claimed source revision and retry budget for one send.""" + + webmention_uuid: uuid.UUID + revision: int + attempt_number: int + max_attempts: int + source: str + target: str + + +@dataclass(frozen=True) +class DeliveryResult: + """HTTP outcome, with whether the failure is eligible for another attempt. + + ``retryable`` describes the failure type; it does not account for the + remaining retry budget, which may already have been exhausted. + """ + + status: SentWebmentionStatus + reason: str | None = None + endpoint: str | None = None + response_status: int | None = None + status_url: str | None = None + retryable: bool = False + + def revision_still_pending(webmention: SentWebmention, revision: int) -> bool: """Check whether a send attempt still represents the desired revision. @@ -83,34 +111,6 @@ def send_webmention(webmention_uuid: uuid.UUID) -> None: return -@dataclass(frozen=True) -class ClaimedSendAttempt: - """Claimed source revision and retry budget for one send.""" - - webmention_uuid: uuid.UUID - revision: int - attempt_number: int - max_attempts: int - source: str - target: str - - -@dataclass(frozen=True) -class DeliveryResult: - """HTTP outcome, with whether the failure is eligible for another attempt. - - ``retryable`` describes the failure type; it does not account for the - remaining retry budget, which may already have been exhausted. - """ - - status: SentWebmentionStatus - reason: str | None = None - endpoint: str | None = None - response_status: int | None = None - status_url: str | None = None - retryable: bool = False - - def is_ready_to_send(webmention: SentWebmention, now: datetime) -> bool: """Return whether an unprocessed Webmention has reached its retry deadline. -- cgit v1.3.1