From a7879fde33769a3facc3b2e4e5a31f98b67d28db Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Thu, 12 Nov 2026 20:46:32 +0100 Subject: refactor(core): simplify task control flow Replace unnecessary pattern matching and temporary assignments with direct conditionals and inline configuration access without changing task behavior. --- webmentions_ssg/tasks/receiver.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'webmentions_ssg/tasks/receiver.py') diff --git a/webmentions_ssg/tasks/receiver.py b/webmentions_ssg/tasks/receiver.py index bed923c..9073930 100644 --- a/webmentions_ssg/tasks/receiver.py +++ b/webmentions_ssg/tasks/receiver.py @@ -63,16 +63,16 @@ def fetch_source(source_url: str) -> tuple[httpx.Response, bytes]: ) as client, client.stream("GET", source_url) as response, ): - match response.status_code: - case 200: - pass - case 410: - raise SourceGoneError("Source returned HTTP 410") - case status: - if is_temporary_status(status): - raise TemporaryFetchError(f"Source returned HTTP {status}") - else: - raise VerificationError(f"Source returned HTTP {status}") + if response.status_code == 200: + pass + elif response.status_code == 410: + raise SourceGoneError("Source returned HTTP 410") + elif is_temporary_status(response.status_code): + raise TemporaryFetchError( + f"Source returned HTTP {response.status_code}" + ) + else: + raise VerificationError(f"Source returned HTTP {response.status_code}") try: return response, read_limited_body( -- cgit v1.3.1