From 71db08c05197545944949d5aa76cd340e7143627 Mon Sep 17 00:00:00 2001 From: James Addison <55152140+jayaddison@users.noreply.github.com> Date: Sun, 23 Jul 2023 14:31:09 +0100 Subject: [PATCH] Style refactoring in the ``linkcheck`` builder (#11501) - Omit a variable that is unused aside from a ``return`` statement on the subsequent line. - Extract a variable for readability, and to reduce the complexity of a line. --- sphinx/builders/linkcheck.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index b4ee064ed..428669349 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -441,7 +441,8 @@ class HyperlinkAvailabilityCheckWorker(Thread): return 'broken', error_message, 0 # Success; clear rate limits for the origin - self.rate_limits.pop(urlsplit(req_url).netloc, None) + netloc = urlsplit(req_url).netloc + self.rate_limits.pop(netloc, None) if ((response_url.rstrip('/') == req_url.rstrip('/')) or _allowed_redirect(req_url, response_url, @@ -503,8 +504,7 @@ def _get_request_headers( for u in candidates: if u in request_headers: - headers = {**DEFAULT_REQUEST_HEADERS, **request_headers[u]} - return headers + return {**DEFAULT_REQUEST_HEADERS, **request_headers[u]} return {}