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.
This commit is contained in:
James Addison
2023-07-23 14:31:09 +01:00
committed by GitHub
parent aabcda94cf
commit 71db08c051

View File

@@ -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 {}