diff --git a/linkcheck/decorators.py b/linkcheck/decorators.py index 85c23457..5b18f84a 100644 --- a/linkcheck/decorators.py +++ b/linkcheck/decorators.py @@ -118,10 +118,10 @@ def synchronize (lock, func): def synchronized (lock): - """ - A decorator calling a function with aqcuired lock. - """ - return lambda func: synchronize(lock, func) + """ + A decorator calling a function with aqcuired lock. + """ + return lambda func: synchronize(lock, func) def notimplemented (func): @@ -193,4 +193,3 @@ class curried (object): return curried(self.func, *args) else: return self.func(*args) - diff --git a/linkcheck/dns/resolver.py b/linkcheck/dns/resolver.py index 862653fc..a80df051 100644 --- a/linkcheck/dns/resolver.py +++ b/linkcheck/dns/resolver.py @@ -585,9 +585,9 @@ class Resolver(object): request.use_tsig(self.keyring, self.keyname) request.use_edns(self.edns, self.ednsflags, self.payload) response = None - + # make a copy of the servers list so we can alter it later. - + nameservers = self.nameservers[:] backoff = 0.10 while response is None: @@ -605,24 +605,24 @@ class Resolver(object): response = linkcheck.dns.query.udp(request, nameserver, timeout, self.port) except (socket.error, linkcheck.dns.exception.Timeout): - + # Communication failure or timeout. Go to the # next server - + response = None continue except linkcheck.dns.query.UnexpectedSource: - + # Who knows? Keep going. - + response = None continue except linkcheck.dns.exception.FormError: - + # We don't understand what this server is # saying. Take it out of the mix and # continue. - + nameservers.remove(nameserver) response = None continue @@ -630,22 +630,22 @@ class Resolver(object): if rcode == linkcheck.dns.rcode.NOERROR or \ rcode == linkcheck.dns.rcode.NXDOMAIN: break - + # We got a response, but we're not happy with the # rcode in it. Remove the server from the mix if # the rcode isn't SERVFAIL. - + if rcode != linkcheck.dns.rcode.SERVFAIL: nameservers.remove(nameserver) response = None - + # All nameservers failed! - + if len(nameservers) > 0: - + # But we still have servers to try. Sleep a bit # so we don't pound them! - + timeout = self._compute_timeout(start) sleep_time = min(timeout, backoff) backoff *= 2 diff --git a/linkcheck/fileutil.py b/linkcheck/fileutil.py index c8840226..4f06411d 100644 --- a/linkcheck/fileutil.py +++ b/linkcheck/fileutil.py @@ -61,7 +61,7 @@ def has_module (name): """ try: exec "import %s" % name - return True + return True except ImportError: return False @@ -170,4 +170,3 @@ def has_changed (filename): _mtime_cache[key] = mtime return True return mtime > _mtime_cache[key] -