Merge pull request #2313 from alex/idiomatic

Make some code in linkcheck more idiomatic
This commit is contained in:
Georg Brandl 2016-02-13 18:12:02 +01:00
commit fed5a34568

View File

@ -204,10 +204,9 @@ class CheckExternalLinksBuilder(Builder):
def check(): def check():
# check for various conditions without bothering the network # check for various conditions without bothering the network
if len(uri) == 0 or uri[0] == '#' or \ if len(uri) == 0 or uri.startswith(('#', 'mailto:', 'ftp:')):
uri[0:7] == 'mailto:' or uri[0:4] == 'ftp:':
return 'unchecked', '', 0 return 'unchecked', '', 0
elif not (uri[0:5] == 'http:' or uri[0:6] == 'https:'): elif not uri.startswith(('http:', 'https:')):
return 'local', '', 0 return 'local', '', 0
elif uri in self.good: elif uri in self.good:
return 'working', 'old', 0 return 'working', 'old', 0