aboutsummaryrefslogtreecommitdiff
path: root/webmentions_ssg/tasks/scanner.py
diff options
context:
space:
mode:
authorDennis Fink2026-11-12 20:46:32 +0100
committerDennis Fink2026-11-12 20:46:32 +0100
commita7879fde33769a3facc3b2e4e5a31f98b67d28db (patch)
tree70c76fdcbea041e8672f17959d66ea005e874a13 /webmentions_ssg/tasks/scanner.py
parent4bd1d9e348918b2e55db47a1ac3489d035cf55e2 (diff)
downloadwebmentions-ssg-a7879fde33769a3facc3b2e4e5a31f98b67d28db.tar.gz
webmentions-ssg-a7879fde33769a3facc3b2e4e5a31f98b67d28db.zip
refactor(core): simplify task control flow
Replace unnecessary pattern matching and temporary assignments with direct conditionals and inline configuration access without changing task behavior.
Diffstat (limited to '')
-rw-r--r--webmentions_ssg/tasks/scanner.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/webmentions_ssg/tasks/scanner.py b/webmentions_ssg/tasks/scanner.py
index b2d6def..1b1c6ef 100644
--- a/webmentions_ssg/tasks/scanner.py
+++ b/webmentions_ssg/tasks/scanner.py
@@ -133,9 +133,7 @@ def scan_sources_task() -> None:
if not root.is_dir():
raise RuntimeError(f"Source directory is not a directory: {root}")
- base_url = current_app.config.get("SOURCE_BASE_URL")
-
- if base_url is not None:
+ if (base_url := current_app.config.get("SOURCE_BASE_URL")) is not None:
if not is_http_url(base_url):
raise RuntimeError("SOURCE_BASE_URL must be an absolute HTTP or HTTPS URL")
base_url = f"{base_url.rstrip('/')}/"
@@ -146,6 +144,7 @@ def scan_sources_task() -> None:
sa.select(Source).options(selectinload(Source.sent_webmentions))
)
}
+
# Existing sources retain their canonical URLs even when marked deleted.
# Reserve these URLs before scanning so an alias cannot claim one just
# because it is discovered earlier than its persisted owner.