From 3f2612ee787ebaaecacaa8b4b2a1f32afa33a332 Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Sat, 13 Feb 2016 09:54:51 -0500 Subject: [PATCH] Make some code in linkcheck more idiomatic --- sphinx/builders/linkcheck.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index 175966116e..09d593c2c4 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -200,10 +200,9 @@ class CheckExternalLinksBuilder(Builder): def check(): # check for various conditions without bothering the network - if len(uri) == 0 or uri[0] == '#' or \ - uri[0:7] == 'mailto:' or uri[0:4] == 'ftp:': + if len(uri) == 0 or uri.startswith(('#', 'mailto:', 'ftp:')): return 'unchecked', '', 0 - elif not (uri[0:5] == 'http:' or uri[0:6] == 'https:'): + elif not uri.startswith(('http:', 'https:')): return 'local', '', 0 elif uri in self.good: return 'working', 'old', 0