diff options
| author | danieleades <33452915+danieleades@users.noreply.github.com> | 2023-01-02 04:52:46 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-01-02 04:52:46 +0000 |
| commit | 2759c2c76b5cd09e9dfffbd88ea1b200dcd8d6ae (patch) | |
| tree | a1ffe3ce69c2fbf2dd457906622fb6ca6cc08501 /sphinx/builders | |
| parent | da6a20d50b725f6c33f0f940e2a59c9a4e7edc15 (diff) | |
| download | sphinx-git-2759c2c76b5cd09e9dfffbd88ea1b200dcd8d6ae.tar.gz | |
Use ``any`` to find elements in iterable (#11053)
Diffstat (limited to 'sphinx/builders')
| -rw-r--r-- | sphinx/builders/linkcheck.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index bdce45c68..8b750df2d 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -382,11 +382,11 @@ class HyperlinkAvailabilityCheckWorker(Thread): return 'redirected', new_url, 0 def allowed_redirect(url: str, new_url: str) -> bool: - for from_url, to_url in self.config.linkcheck_allowed_redirects.items(): - if from_url.match(url) and to_url.match(new_url): - return True - - return False + return any( + from_url.match(url) and to_url.match(new_url) + for from_url, to_url + in self.config.linkcheck_allowed_redirects.items() + ) def check(docname: str) -> tuple[str, str, int]: # check for various conditions without bothering the network |
