Skip to content

Commit

Permalink
Style refactoring in the linkcheck builder (sphinx-doc#11501)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
jayaddison committed Jul 23, 2023
1 parent aabcda9 commit 71db08c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sphinx/builders/linkcheck.py
Expand Up @@ -441,7 +441,8 @@ def _check_uri(self, uri: str, hyperlink: Hyperlink) -> tuple[str, str, int]:
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,
Expand Down Expand Up @@ -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 {}


Expand Down

0 comments on commit 71db08c

Please sign in to comment.