aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/tasks/verification.py
diff options
context:
space:
mode:
authorDennis Fink2026-11-16 09:27:29 +0100
committerDennis Fink2026-11-16 09:27:29 +0100
commit85b10c38f39732421a230d938adddc7805d0e001 (patch)
tree396f29962fac45245c6f1486e188ad905588659d /webmentions_ssg/tasks/verification.py
parenteb404d9a1a328278c92753e65100579e7ad98e48 (diff)
downloadwebmentions-ssg-85b10c38f39732421a230d938adddc7805d0e001.tar.gz
webmentions-ssg-85b10c38f39732421a230d938adddc7805d0e001.zip
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.
Diffstat (limited to 'webmentions_ssg/tasks/verification.py')
-rw-r--r--webmentions_ssg/tasks/verification.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/webmentions_ssg/tasks/verification.py b/webmentions_ssg/tasks/verification.py
index a614815..b0f4d0f 100644
--- a/webmentions_ssg/tasks/verification.py
+++ b/webmentions_ssg/tasks/verification.py
@@ -29,6 +29,9 @@ from ..version import APP_NAME, VERSION
from .target_matching import html_mentions_target, text_mentions_target
+RECOVERY_EXHAUSTED_REASON = "Verification recovery limit reached"
+
+
class VerificationError(Exception):
"""The source permanently failed ReceivedWebmention verification."""
@@ -41,7 +44,14 @@ class RetryableFetchError(Exception):
"""Fetching the source may succeed when retried later."""
-RECOVERY_EXHAUSTED_REASON = "Verification recovery limit reached"
+@dataclass(frozen=True)
+class VerificationClaim:
+ """Source and lease version for one atomically claimed verification."""
+
+ webmention_uuid: uuid.UUID
+ source: str
+ target: str
+ lease_started_at: datetime
def fetch_source_document(source_url: str) -> tuple[httpx.Response, bytes]:
@@ -125,16 +135,6 @@ def source_mentions_target(source_url: str, target_url: str) -> bool:
)
-@dataclass(frozen=True)
-class VerificationClaim:
- """Source and lease version for one atomically claimed verification."""
-
- webmention_uuid: uuid.UUID
- source: str
- target: str
- lease_started_at: datetime
-
-
def claim_for_verification(webmention_uuid: uuid.UUID) -> VerificationClaim | None:
"""Claim an eligible row, returning its source, target, and lease version.