mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-04-16 12:21:13 +00:00
Remove inheriting object
All Python 3 classes are new-style.
This commit is contained in:
parent
b0ea72e8c1
commit
44e81d27dd
23 changed files with 30 additions and 31 deletions
|
|
@ -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):
|
||||
|
|
|
|||
2
linkcheck/cache/results.py
vendored
2
linkcheck/cache/results.py
vendored
|
|
@ -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
|
||||
|
|
|
|||
2
linkcheck/cache/robots_txt.py
vendored
2
linkcheck/cache/robots_txt.py
vendored
|
|
@ -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)}
|
||||
|
|
|
|||
2
linkcheck/cache/urlqueue.py
vendored
2
linkcheck/cache/urlqueue.py
vendored
|
|
@ -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()."""
|
||||
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ def read_multiline (value):
|
|||
yield line
|
||||
|
||||
|
||||
class LCConfigParser (RawConfigParser, object):
|
||||
class LCConfigParser (RawConfigParser):
|
||||
"""
|
||||
Parse a LinkChecker configuration file.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -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."""
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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=''):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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, ...)
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue