diff --git a/linkcheck/ansicolor.py b/linkcheck/ansicolor.py index 2658948a..efd7c35c 100644 --- a/linkcheck/ansicolor.py +++ b/linkcheck/ansicolor.py @@ -249,12 +249,11 @@ else: write_color = _write_color_ansi -class Colorizer (object): +class Colorizer: """Prints colored messages to streams.""" def __init__ (self, fp): """Initialize with given stream (file-like object).""" - super(Colorizer, self).__init__() self.fp = fp if has_colors(fp): self.write = self._write_color @@ -277,7 +276,7 @@ class Colorizer (object): return getattr(self.fp, name) -class ColoredStreamHandler (logging.StreamHandler, object): +class ColoredStreamHandler (logging.StreamHandler): """Send colored log messages to streams (file-like objects).""" def __init__ (self, strm=None): diff --git a/linkcheck/cache/results.py b/linkcheck/cache/results.py index 051e302f..90b9462b 100644 --- a/linkcheck/cache/results.py +++ b/linkcheck/cache/results.py @@ -24,7 +24,7 @@ from ..lock import get_lock cache_lock = get_lock("results_cache_lock") -class ResultCache(object): +class ResultCache: """ Thread-safe cache of UrlData.to_wire() results. the cache is limited in size since we rather recheck the same URL diff --git a/linkcheck/cache/robots_txt.py b/linkcheck/cache/robots_txt.py index 18c30075..d0b6fe6b 100644 --- a/linkcheck/cache/robots_txt.py +++ b/linkcheck/cache/robots_txt.py @@ -27,7 +27,7 @@ cache_lock = get_lock("robots.txt_cache_lock") robot_lock = get_lock("robots.txt_robot_lock") -class RobotsTxt (object): +class RobotsTxt: """ Thread-safe cache of downloaded robots.txt files. format: {cache key (string) -> robots.txt content (RobotFileParser)} diff --git a/linkcheck/cache/urlqueue.py b/linkcheck/cache/urlqueue.py index f8300ad7..1961ce28 100644 --- a/linkcheck/cache/urlqueue.py +++ b/linkcheck/cache/urlqueue.py @@ -33,7 +33,7 @@ class Empty(Exception): NUM_PUTS_CLEANUP = 10000 -class UrlQueue (object): +class UrlQueue: """A queue supporting several consumer tasks. The task_done() idea is from the Python 2.5 implementation of Queue.Queue().""" diff --git a/linkcheck/checker/proxysupport.py b/linkcheck/checker/proxysupport.py index 6e04b533..cd5a9473 100644 --- a/linkcheck/checker/proxysupport.py +++ b/linkcheck/checker/proxysupport.py @@ -28,7 +28,7 @@ import os from .. import LinkCheckerError, log, LOG_CHECK, url as urlutil, httputil -class ProxySupport (object): +class ProxySupport: """Get support for proxying and for URLs with user:pass@host setting.""" def set_proxy (self, proxy): diff --git a/linkcheck/checker/urlbase.py b/linkcheck/checker/urlbase.py index dddeccca..72fe1e48 100644 --- a/linkcheck/checker/urlbase.py +++ b/linkcheck/checker/urlbase.py @@ -80,7 +80,7 @@ def url_norm (url, encoding): raise LinkCheckerError(msg) -class UrlBase (object): +class UrlBase: """An URL with additional information like validity etc.""" # file types that can be parsed recursively @@ -857,7 +857,7 @@ urlDataAttr = [ 'level', ] -class CompactUrlData (object): +class CompactUrlData: """Store selected UrlData attributes in slots to minimize memory usage.""" __slots__ = urlDataAttr diff --git a/linkcheck/configuration/confparse.py b/linkcheck/configuration/confparse.py index dce3bcbc..421f0d03 100644 --- a/linkcheck/configuration/confparse.py +++ b/linkcheck/configuration/confparse.py @@ -32,7 +32,7 @@ def read_multiline (value): yield line -class LCConfigParser (RawConfigParser, object): +class LCConfigParser (RawConfigParser): """ Parse a LinkChecker configuration file. """ diff --git a/linkcheck/decorators.py b/linkcheck/decorators.py index 90d502bd..fc5fab13 100644 --- a/linkcheck/decorators.py +++ b/linkcheck/decorators.py @@ -135,7 +135,7 @@ def timed (log=sys.stderr, limit=2.0): return lambda func: timeit(func, log, limit) -class curried (object): +class curried: """Decorator that returns a function that keeps returning functions until all arguments are supplied; then the original function is evaluated.""" diff --git a/linkcheck/director/aggregator.py b/linkcheck/director/aggregator.py index 8c90c681..6600b3e4 100644 --- a/linkcheck/director/aggregator.py +++ b/linkcheck/director/aggregator.py @@ -56,7 +56,7 @@ def new_request_session(config, cookies): return session -class Aggregate (object): +class Aggregate: """Store thread-safe data collections for checker threads.""" def __init__ (self, config, urlqueue, robots_txt, plugin_manager, diff --git a/linkcheck/director/console.py b/linkcheck/director/console.py index 2b15462c..2d962072 100644 --- a/linkcheck/director/console.py +++ b/linkcheck/director/console.py @@ -26,7 +26,7 @@ stderr = i18n.get_encoded_writer(out=sys.stderr) stdout = i18n.get_encoded_writer() -class StatusLogger (object): +class StatusLogger: """Standard status logger. Default output is stderr.""" def __init__ (self, fd=stderr): diff --git a/linkcheck/director/logger.py b/linkcheck/director/logger.py index 569421e7..51f13014 100644 --- a/linkcheck/director/logger.py +++ b/linkcheck/director/logger.py @@ -23,7 +23,7 @@ from ..decorators import synchronized _lock = threading.Lock() -class Logger (object): +class Logger: """Thread safe multi-logger class used by aggregator instances.""" def __init__ (self, config): diff --git a/linkcheck/dummy.py b/linkcheck/dummy.py index 3667104b..dc8ef97c 100644 --- a/linkcheck/dummy.py +++ b/linkcheck/dummy.py @@ -17,7 +17,7 @@ Dummy objects. """ -class Dummy (object): +class Dummy: """A dummy object ignores all access to it. Useful for testing.""" def __init__ (self, *args, **kwargs): diff --git a/linkcheck/fileutil.py b/linkcheck/fileutil.py index 50c0fa41..a8e9bf11 100644 --- a/linkcheck/fileutil.py +++ b/linkcheck/fileutil.py @@ -44,7 +44,7 @@ def has_module (name, without_error=True): return not without_error -class GlobDirectoryWalker (object): +class GlobDirectoryWalker: """A forward iterator that traverses a directory tree.""" def __init__ (self, directory, pattern="*"): @@ -78,7 +78,7 @@ class GlobDirectoryWalker (object): rglob = GlobDirectoryWalker -class Buffer (object): +class Buffer: """Holds buffered data""" def __init__ (self, empty=''): diff --git a/linkcheck/htmlutil/loginformsearch.py b/linkcheck/htmlutil/loginformsearch.py index fdddb585..0beb69e8 100644 --- a/linkcheck/htmlutil/loginformsearch.py +++ b/linkcheck/htmlutil/loginformsearch.py @@ -19,7 +19,7 @@ HTML form utils from ..htmlutil import htmlsoup from .. import log, LOG_CHECK -class Form(object): +class Form: """Store HTML form URL and form data.""" def __init__(self, url): diff --git a/linkcheck/lc_cgi.py b/linkcheck/lc_cgi.py index a7d1f2b9..f62b7df2 100644 --- a/linkcheck/lc_cgi.py +++ b/linkcheck/lc_cgi.py @@ -93,7 +93,7 @@ def formvalue (form, key): _lock = threading.Lock() -class ThreadsafeIO (object): +class ThreadsafeIO: """Thread-safe unicode I/O class.""" def __init__(self): diff --git a/linkcheck/lock.py b/linkcheck/lock.py index 342e3359..66d30dac 100644 --- a/linkcheck/lock.py +++ b/linkcheck/lock.py @@ -33,7 +33,7 @@ def get_lock (name, debug=False): return lock -class DebugLock (object): +class DebugLock: """Debugging lock class.""" def __init__ (self, lock, name): diff --git a/linkcheck/logger/__init__.py b/linkcheck/logger/__init__.py index 934c40ad..8a3054e2 100644 --- a/linkcheck/logger/__init__.py +++ b/linkcheck/logger/__init__.py @@ -57,7 +57,7 @@ ContentTypes = dict( ) -class LogStatistics (object): +class LogStatistics: """Gather log statistics: - number of errors, warnings and valid links - type of contents (image, video, audio, text, ...) diff --git a/linkcheck/parser/sitemap.py b/linkcheck/parser/sitemap.py index 68ebe3c3..1c15674f 100644 --- a/linkcheck/parser/sitemap.py +++ b/linkcheck/parser/sitemap.py @@ -20,7 +20,7 @@ from xml.parsers.expat import ParserCreate from xml.parsers.expat import ExpatError from ..checker.const import (WARN_XML_PARSE_ERROR) -class XmlTagUrlParser(object): +class XmlTagUrlParser: """Parse XML files and find URLs in text content of a tag name.""" def __init__(self, tag): diff --git a/linkcheck/plugins/__init__.py b/linkcheck/plugins/__init__.py index b59364f4..4a21678f 100644 --- a/linkcheck/plugins/__init__.py +++ b/linkcheck/plugins/__init__.py @@ -20,7 +20,7 @@ from .. import loader, log, LOG_PLUGIN from ..decorators import notimplemented -class _PluginBase(object): +class _PluginBase: """Basic plugin class featuring plugin identification and helper functions.""" @@ -75,7 +75,7 @@ def get_plugin_classes(modules): return loader.get_plugins(modules, classes) -class PluginManager(object): +class PluginManager: """Manage all connection and content plugins.""" def __init__(self, config): diff --git a/linkcheck/plugins/syntaxchecks.py b/linkcheck/plugins/syntaxchecks.py index b6f7d8ad..4cb02ec1 100644 --- a/linkcheck/plugins/syntaxchecks.py +++ b/linkcheck/plugins/syntaxchecks.py @@ -25,7 +25,7 @@ from ..decorators import synchronized _w3_time_lock = threading.Lock() -class W3Timer(object): +class W3Timer: """Ensure W3C apis are not hammered.""" # every X seconds diff --git a/linkcheck/plugins/viruscheck.py b/linkcheck/plugins/viruscheck.py index 41c50067..fdba476d 100644 --- a/linkcheck/plugins/viruscheck.py +++ b/linkcheck/plugins/viruscheck.py @@ -70,7 +70,7 @@ class ClamavError (Exception): pass -class ClamdScanner (object): +class ClamdScanner: """Virus scanner using a clamd daemon process.""" def __init__ (self, clamav_conf): diff --git a/linkcheck/robotparser2.py b/linkcheck/robotparser2.py index 5932b0f9..4d202053 100644 --- a/linkcheck/robotparser2.py +++ b/linkcheck/robotparser2.py @@ -38,7 +38,7 @@ __all__ = ["RobotFileParser"] ACCEPT_ENCODING = 'x-gzip,gzip,deflate' -class RobotFileParser (object): +class RobotFileParser: """This class provides a set of methods to read, parse and answer questions about a single robots.txt file.""" @@ -271,7 +271,7 @@ class RobotFileParser (object): return "\n\n".join(lines) -class RuleLine (object): +class RuleLine: """A rule line is a single "Allow:" (allowance==1) or "Disallow:" (allowance==0) followed by a path. """ @@ -302,7 +302,7 @@ class RuleLine (object): return ("Allow" if self.allowance else "Disallow")+": "+self.path -class Entry (object): +class Entry: """An entry has one or more user-agents and zero or more rulelines.""" def __init__ (self): diff --git a/tests/checker/httpserver.py b/tests/checker/httpserver.py index e6920f95..fb634685 100644 --- a/tests/checker/httpserver.py +++ b/tests/checker/httpserver.py @@ -32,7 +32,7 @@ from . import LinkCheckTest from .. import get_file -class StoppableHttpRequestHandler (SimpleHTTPRequestHandler, object): +class StoppableHttpRequestHandler (SimpleHTTPRequestHandler): """ HTTP request handler with QUIT stopping the server. """ @@ -57,7 +57,7 @@ StoppableHttpRequestHandler.extensions_map.update({ }) -class StoppableHttpServer (HTTPServer, object): +class StoppableHttpServer (HTTPServer): """ HTTP server that reacts to self.stop flag. """