diff --git a/linkcheck/ansicolor.py b/linkcheck/ansicolor.py index 01a04507..d096842c 100644 --- a/linkcheck/ansicolor.py +++ b/linkcheck/ansicolor.py @@ -286,7 +286,7 @@ class ColoredStreamHandler(logging.StreamHandler): """Log to given stream (a file-like object) or to stderr if strm is None. """ - super(ColoredStreamHandler, self).__init__(strm) + super().__init__(strm) self.stream = Colorizer(self.stream) # standard log level colors (used by get_color) self.colors = { diff --git a/linkcheck/checker/fileurl.py b/linkcheck/checker/fileurl.py index 725c0476..a5d36ecf 100644 --- a/linkcheck/checker/fileurl.py +++ b/linkcheck/checker/fileurl.py @@ -107,7 +107,7 @@ class FileUrl(urlbase.UrlBase): extern, ): """Initialize the scheme.""" - super(FileUrl, self).init( + super().init( base_ref, base_url, parent_url, @@ -170,7 +170,7 @@ class FileUrl(urlbase.UrlBase): # ignore query part for filesystem urls urlparts[3] = '' self.base_url = urlutil.urlunsplit(urlparts) - super(FileUrl, self).build_url() + super().build_url() # ignore query and fragment url parts for filesystem urls self.urlparts[3] = self.urlparts[4] = '' if self.is_directory() and not self.urlparts[2].endswith('/'): @@ -237,7 +237,7 @@ class FileUrl(urlbase.UrlBase): if isinstance(data, str): data = data.encode("iso8859-1", "ignore") else: - data = super(FileUrl, self).read_content() + data = super().read_content() return data def get_os_filename(self): @@ -312,6 +312,4 @@ class FileUrl(urlbase.UrlBase): if webroot and url and url.startswith("/"): url = webroot + url[1:] log.debug(LOG_CHECK, "Applied local webroot `%s' to `%s'.", webroot, url) - super(FileUrl, self).add_url( - url, line=line, column=column, page=page, name=name, base=base - ) + super().add_url(url, line=line, column=column, page=page, name=name, base=base) diff --git a/linkcheck/checker/ftpurl.py b/linkcheck/checker/ftpurl.py index c8b4be31..29f7cd13 100644 --- a/linkcheck/checker/ftpurl.py +++ b/linkcheck/checker/ftpurl.py @@ -34,7 +34,7 @@ class FtpUrl(internpaturl.InternPatternUrl, proxysupport.ProxySupport): """ Initialize FTP url data. """ - super(FtpUrl, self).reset() + super().reset() # list of files for recursion self.files = [] # last part of URL filename diff --git a/linkcheck/checker/httpurl.py b/linkcheck/checker/httpurl.py index 975b8f16..bb67b4d4 100644 --- a/linkcheck/checker/httpurl.py +++ b/linkcheck/checker/httpurl.py @@ -66,7 +66,7 @@ class HttpUrl(internpaturl.InternPatternUrl, proxysupport.ProxySupport): """ Initialize HTTP specific variables. """ - super(HttpUrl, self).reset() + super().reset() # initialize check data # server headers self.headers = {} diff --git a/linkcheck/checker/itmsservicesurl.py b/linkcheck/checker/itmsservicesurl.py index 919c4df0..982c8acb 100644 --- a/linkcheck/checker/itmsservicesurl.py +++ b/linkcheck/checker/itmsservicesurl.py @@ -26,7 +26,7 @@ class ItmsServicesUrl(urlbase.UrlBase): def check_syntax(self): """Only logs that this URL is unknown.""" - super(ItmsServicesUrl, self).check_syntax() + super().check_syntax() if "url=" not in self.urlparts[3]: self.set_result(_("Missing required url parameter"), valid=False) diff --git a/linkcheck/checker/mailtourl.py b/linkcheck/checker/mailtourl.py index 2833cb18..5f358c13 100644 --- a/linkcheck/checker/mailtourl.py +++ b/linkcheck/checker/mailtourl.py @@ -74,7 +74,7 @@ class MailtoUrl(urlbase.UrlBase): """Call super.build_url(), extract list of mail addresses from URL, and check their syntax. """ - super(MailtoUrl, self).build_url() + super().build_url() self.addresses = set() self.subject = None self.parse_addresses() diff --git a/linkcheck/checker/telneturl.py b/linkcheck/checker/telneturl.py index cfab5893..7b27750c 100644 --- a/linkcheck/checker/telneturl.py +++ b/linkcheck/checker/telneturl.py @@ -37,7 +37,7 @@ class TelnetUrl(urlbase.UrlBase): Call super.build_url(), set default telnet port and initialize the login credentials. """ - super(TelnetUrl, self).build_url() + super().build_url() # default port if self.port is None: self.port = 23 @@ -51,7 +51,7 @@ class TelnetUrl(urlbase.UrlBase): if not self.host: self.set_result(_("Host is empty"), valid=False) return - super(TelnetUrl, self).local_check() + super().local_check() def check_connection(self): """ diff --git a/linkcheck/checker/unknownurl.py b/linkcheck/checker/unknownurl.py index d3c9c145..00029a46 100644 --- a/linkcheck/checker/unknownurl.py +++ b/linkcheck/checker/unknownurl.py @@ -26,7 +26,7 @@ class UnknownUrl(urlbase.UrlBase): def build_url(self): """Only logs that this URL is unknown.""" - super(UnknownUrl, self).build_url() + super().build_url() if self.is_ignored(): self.add_info( _("%(scheme)s URL ignored.") % {"scheme": self.scheme.capitalize()} diff --git a/linkcheck/configuration/__init__.py b/linkcheck/configuration/__init__.py index 63458340..415926bc 100644 --- a/linkcheck/configuration/__init__.py +++ b/linkcheck/configuration/__init__.py @@ -160,7 +160,7 @@ class Configuration(dict): """ Initialize the default options. """ - super(Configuration, self).__init__() + super().__init__() # checking options self["allowedschemes"] = [] self['cookiefile'] = None diff --git a/linkcheck/configuration/confparse.py b/linkcheck/configuration/confparse.py index 1b8ff9e6..a155d99c 100644 --- a/linkcheck/configuration/confparse.py +++ b/linkcheck/configuration/confparse.py @@ -45,7 +45,7 @@ class LCConfigParser(RawConfigParser): def __init__(self, config): """Initialize configuration.""" - super(LCConfigParser, self).__init__() + super().__init__() self.config = config def read(self, files): @@ -55,7 +55,7 @@ class LCConfigParser(RawConfigParser): """ assert isinstance(files, list), "Invalid file list %r" % files try: - self.read_ok = super(LCConfigParser, self).read(files) + self.read_ok = super().read(files) if len(self.read_ok) < len(files): failed_files = set(files) - set(self.read_ok) log.warn( diff --git a/linkcheck/containers.py b/linkcheck/containers.py index 117971f3..e7820bd1 100644 --- a/linkcheck/containers.py +++ b/linkcheck/containers.py @@ -23,7 +23,7 @@ class LFUCache(dict): def __init__(self, size=1000): """Initialize internal LFU cache.""" - super(LFUCache, self).__init__() + super().__init__() if size < 1: raise ValueError("invalid cache size %d" % size) self.size = size @@ -32,9 +32,9 @@ class LFUCache(dict): """Store given key/value.""" if key in self: # store value, do not increase number of uses - super(LFUCache, self).__getitem__(key)[1] = val + super().__getitem__(key)[1] = val else: - super(LFUCache, self).__setitem__(key, [0, val]) + super().__setitem__(key, [0, val]) # check for size limit if len(self) > self.size: self.shrink() @@ -43,7 +43,7 @@ class LFUCache(dict): """Shrink ca. 5% of entries.""" trim = int(0.05 * len(self)) if trim: - items = super(LFUCache, self).items() + items = super().items() # sorting function for items def keyfunc(x): return x[1][0] values = sorted(items, key=keyfunc) @@ -52,14 +52,14 @@ class LFUCache(dict): def __getitem__(self, key): """Update key usage and return value.""" - entry = super(LFUCache, self).__getitem__(key) + entry = super().__getitem__(key) entry[0] += 1 return entry[1] def uses(self, key): """Get number of uses for given key (without increasing the number of uses)""" - return super(LFUCache, self).__getitem__(key)[0] + return super().__getitem__(key)[0] def get(self, key, def_val=None): """Update key usage if found and return value, else return default.""" @@ -77,28 +77,28 @@ class LFUCache(dict): def items(self): """Return list of items, not updating usage count.""" - return [(key, value[1]) for key, value in super(LFUCache, self).items()] + return [(key, value[1]) for key, value in super().items()] def iteritems(self): """Return iterator of items, not updating usage count.""" - for key, value in super(LFUCache, self).items(): + for key, value in super().items(): yield (key, value[1]) def values(self): """Return list of values, not updating usage count.""" - return [value[1] for value in super(LFUCache, self).values()] + return [value[1] for value in super().values()] def itervalues(self): """Return iterator of values, not updating usage count.""" - for value in super(LFUCache, self).values(): + for value in super().values(): yield value[1] def popitem(self): """Remove and return an item.""" - key, value = super(LFUCache, self).popitem() + key, value = super().popitem() return (key, value[1]) def pop(self): """Remove and return a value.""" - value = super(LFUCache, self).pop() + value = super().pop() return value[1] diff --git a/linkcheck/director/checker.py b/linkcheck/director/checker.py index 07ff4921..732326fb 100644 --- a/linkcheck/director/checker.py +++ b/linkcheck/director/checker.py @@ -82,7 +82,7 @@ class Checker(task.LoggedCheckedTask): def __init__(self, urlqueue, logger, add_request_session): """Store URL queue and logger.""" - super(Checker, self).__init__(logger) + super().__init__(logger) self.urlqueue = urlqueue self.origname = self.getName() self.add_request_session = add_request_session diff --git a/linkcheck/director/interrupt.py b/linkcheck/director/interrupt.py index 11a0513e..c7e832f7 100644 --- a/linkcheck/director/interrupt.py +++ b/linkcheck/director/interrupt.py @@ -32,7 +32,7 @@ class Interrupt(task.CheckedTask): @param duration: raise KeyboardInterrupt after given number of seconds @ptype duration: int """ - super(Interrupt, self).__init__() + super().__init__() self.duration = duration def run_checked(self): diff --git a/linkcheck/director/status.py b/linkcheck/director/status.py index 631e9585..11414dc1 100644 --- a/linkcheck/director/status.py +++ b/linkcheck/director/status.py @@ -31,7 +31,7 @@ class Status(task.LoggedCheckedTask): @ptype wait_seconds: int """ logger = aggregator.config.status_logger - super(Status, self).__init__(logger) + super().__init__(logger) self.aggregator = aggregator self.wait_seconds = wait_seconds assert self.wait_seconds >= 1 diff --git a/linkcheck/director/task.py b/linkcheck/director/task.py index 389c6575..807f8f14 100644 --- a/linkcheck/director/task.py +++ b/linkcheck/director/task.py @@ -48,7 +48,7 @@ class LoggedCheckedTask(CheckedTask): def __init__(self, logger): """Initialize super instance and store given logger.""" - super(CheckedTask, self).__init__() + super().__init__() self.logger = logger def internal_error(self): diff --git a/linkcheck/logger/blacklist.py b/linkcheck/logger/blacklist.py index 203ba36b..050075c0 100644 --- a/linkcheck/logger/blacklist.py +++ b/linkcheck/logger/blacklist.py @@ -39,7 +39,7 @@ class BlacklistLogger(_Logger): def __init__(self, **kwargs): """Intialize with old blacklist data (if found, else not).""" args = self.get_args(kwargs) - super(BlacklistLogger, self).__init__(**args) + super().__init__(**args) self.init_fileoutput(args) self.blacklist = {} if self.filename is not None and os.path.exists(self.filename): diff --git a/linkcheck/logger/csvlog.py b/linkcheck/logger/csvlog.py index 6c7fcba7..76cfc493 100644 --- a/linkcheck/logger/csvlog.py +++ b/linkcheck/logger/csvlog.py @@ -62,7 +62,7 @@ class CSVLogger(_Logger): def __init__(self, **kwargs): """Store default separator and (os dependent) line terminator.""" args = self.get_args(kwargs) - super(CSVLogger, self).__init__(**args) + super().__init__(**args) self.init_fileoutput(args) self.separator = args['separator'] self.quotechar = args['quotechar'] @@ -75,7 +75,7 @@ class CSVLogger(_Logger): def start_output(self): """Write checking start info as csv comment.""" - super(CSVLogger, self).start_output() + super().start_output() row = [] if self.has_part("intro"): self.write_intro() diff --git a/linkcheck/logger/customxml.py b/linkcheck/logger/customxml.py index eccbbf8f..e2103a7a 100644 --- a/linkcheck/logger/customxml.py +++ b/linkcheck/logger/customxml.py @@ -35,7 +35,7 @@ class CustomXMLLogger(xmllog._XMLLogger): """ Write start of checking info as xml comment. """ - super(CustomXMLLogger, self).start_output() + super().start_output() self.xml_start_output() attrs = {"created": strformat.strtime(self.starttime)} self.xml_starttag('linkchecker', attrs) diff --git a/linkcheck/logger/dot.py b/linkcheck/logger/dot.py index b81cb653..04059bcf 100644 --- a/linkcheck/logger/dot.py +++ b/linkcheck/logger/dot.py @@ -34,7 +34,7 @@ class DOTLogger(_GraphLogger): def start_output(self): """Write start of checking info as DOT comment.""" - super(DOTLogger, self).start_output() + super().start_output() if self.has_part("intro"): self.write_intro() self.writeln() diff --git a/linkcheck/logger/gml.py b/linkcheck/logger/gml.py index 0bbbc517..45b2cb0c 100644 --- a/linkcheck/logger/gml.py +++ b/linkcheck/logger/gml.py @@ -31,7 +31,7 @@ class GMLLogger(_GraphLogger): def start_output(self): """Write start of checking info as gml comment.""" - super(GMLLogger, self).start_output() + super().start_output() if self.has_part("intro"): self.write_intro() self.writeln() diff --git a/linkcheck/logger/graph.py b/linkcheck/logger/graph.py index eef6c6e0..f457a42b 100644 --- a/linkcheck/logger/graph.py +++ b/linkcheck/logger/graph.py @@ -27,7 +27,7 @@ class _GraphLogger(_Logger): def __init__(self, **kwargs): """Initialize graph node list and internal id counter.""" args = self.get_args(kwargs) - super(_GraphLogger, self).__init__(**args) + super().__init__(**args) self.init_fileoutput(args) self.nodes = {} self.nodeid = 0 diff --git a/linkcheck/logger/gxml.py b/linkcheck/logger/gxml.py index d66ed612..86bfece6 100644 --- a/linkcheck/logger/gxml.py +++ b/linkcheck/logger/gxml.py @@ -34,13 +34,13 @@ class GraphXMLLogger(_XMLLogger, _GraphLogger): def __init__(self, **kwargs): """Initialize graph node list and internal id counter.""" args = self.get_args(kwargs) - super(GraphXMLLogger, self).__init__(**args) + super().__init__(**args) self.nodes = {} self.nodeid = 0 def start_output(self): """Write start of checking info as xml comment.""" - super(GraphXMLLogger, self).start_output() + super().start_output() self.xml_start_output() self.xml_starttag('GraphXML') self.xml_starttag('graph', attrs={"isDirected": "true"}) diff --git a/linkcheck/logger/html.py b/linkcheck/logger/html.py index 569f1370..1cff3292 100644 --- a/linkcheck/logger/html.py +++ b/linkcheck/logger/html.py @@ -80,7 +80,7 @@ class HtmlLogger(_Logger): def __init__(self, **kwargs): """Initialize default HTML color values.""" args = self.get_args(kwargs) - super(HtmlLogger, self).__init__(**args) + super().__init__(**args) self.init_fileoutput(args) self.colorbackground = args['colorbackground'] self.colorurl = args['colorurl'] @@ -92,7 +92,7 @@ class HtmlLogger(_Logger): def part(self, name): """Return non-space-breakable part name.""" - return super(HtmlLogger, self).part(name).replace(" ", " ") + return super().part(name).replace(" ", " ") def comment(self, s, **args): """Write HTML comment.""" @@ -102,7 +102,7 @@ class HtmlLogger(_Logger): def start_output(self): """Write start of checking info.""" - super(HtmlLogger, self).start_output() + super().start_output() header = { "encoding": self.get_charset_encoding(), "title": configuration.App, diff --git a/linkcheck/logger/sitemapxml.py b/linkcheck/logger/sitemapxml.py index 2ad67957..7f3b16c2 100644 --- a/linkcheck/logger/sitemapxml.py +++ b/linkcheck/logger/sitemapxml.py @@ -47,7 +47,7 @@ class SitemapXmlLogger(xmllog._XMLLogger): def __init__(self, **kwargs): """Initialize graph node list and internal id counter.""" args = self.get_args(kwargs) - super(SitemapXmlLogger, self).__init__(**args) + super().__init__(**args) # All URLs must have the given prefix, which is determined # by the first logged URL. self.prefix = None @@ -66,7 +66,7 @@ class SitemapXmlLogger(xmllog._XMLLogger): def start_output(self): """Write start of checking info as xml comment.""" - super(SitemapXmlLogger, self).start_output() + super().start_output() self.xml_start_output() attrs = {"xmlns": "http://www.sitemaps.org/schemas/sitemap/0.9"} self.xml_starttag('urlset', attrs) diff --git a/linkcheck/logger/sql.py b/linkcheck/logger/sql.py index 05001937..375174da 100644 --- a/linkcheck/logger/sql.py +++ b/linkcheck/logger/sql.py @@ -61,7 +61,7 @@ class SQLLogger(_Logger): def __init__(self, **kwargs): """Initialize database access data.""" args = self.get_args(kwargs) - super(SQLLogger, self).__init__(**args) + super().__init__(**args) self.init_fileoutput(args) self.dbname = args['dbname'] self.separator = args['separator'] @@ -77,7 +77,7 @@ class SQLLogger(_Logger): """ Write start of checking info as sql comment. """ - super(SQLLogger, self).start_output() + super().start_output() if self.has_part("intro"): self.write_intro() self.writeln() diff --git a/linkcheck/logger/text.py b/linkcheck/logger/text.py index 7bb067a0..89b206a1 100644 --- a/linkcheck/logger/text.py +++ b/linkcheck/logger/text.py @@ -55,7 +55,7 @@ class TextLogger(_Logger): def __init__(self, **kwargs): """Initialize error counter and optional file output.""" args = self.get_args(kwargs) - super(TextLogger, self).__init__(**args) + super().__init__(**args) self.output_encoding = args.get("encoding", i18n.default_encoding) self.init_fileoutput(args) self.colorparent = args.get('colorparent', 'default') @@ -73,20 +73,20 @@ class TextLogger(_Logger): def init_fileoutput(self, args): """Colorize file output if possible.""" - super(TextLogger, self).init_fileoutput(args) + super().init_fileoutput(args) if self.fd is not None: self.fd = ansicolor.Colorizer(self.fd) def start_fileoutput(self): """Needed to make file descriptor color aware.""" init_color = self.fd is None - super(TextLogger, self).start_fileoutput() + super().start_fileoutput() if init_color: self.fd = ansicolor.Colorizer(self.fd) def start_output(self): """Write generic start checking info.""" - super(TextLogger, self).start_output() + super().start_output() if self.has_part('intro'): self.write_intro() self.flush() diff --git a/linkcheck/logger/xmllog.py b/linkcheck/logger/xmllog.py index 16a8292a..33338d0a 100644 --- a/linkcheck/logger/xmllog.py +++ b/linkcheck/logger/xmllog.py @@ -49,7 +49,7 @@ class _XMLLogger(_Logger): def __init__(self, **kwargs): """ Initialize graph node list and internal id counter. """ args = self.get_args(kwargs) - super(_XMLLogger, self).__init__(**args) + super().__init__(**args) self.init_fileoutput(args) self.indent = " " self.level = 0 diff --git a/linkcheck/plugins/httpheaderinfo.py b/linkcheck/plugins/httpheaderinfo.py index a06c0f59..7e299d47 100644 --- a/linkcheck/plugins/httpheaderinfo.py +++ b/linkcheck/plugins/httpheaderinfo.py @@ -24,7 +24,7 @@ class HttpHeaderInfo(_ConnectionPlugin): def __init__(self, config): """Initialize configuration.""" - super(HttpHeaderInfo, self).__init__(config) + super().__init__(config) self.prefixes = tuple(config["prefixes"]) def applies_to(self, url_data): diff --git a/linkcheck/plugins/locationinfo.py b/linkcheck/plugins/locationinfo.py index 32c2e028..388fef25 100644 --- a/linkcheck/plugins/locationinfo.py +++ b/linkcheck/plugins/locationinfo.py @@ -34,7 +34,7 @@ class LocationInfo(_ConnectionPlugin): """Check for geoip module.""" if not geoip: log.warn(LOG_PLUGIN, "GeoIP or pygeoip not found for LocationInfo plugin.") - super(LocationInfo, self).__init__(config) + super().__init__(config) def applies_to(self, url_data): """Check for validity, host existence and geoip module.""" diff --git a/linkcheck/plugins/markdowncheck.py b/linkcheck/plugins/markdowncheck.py index e5a68421..c8de2d4c 100644 --- a/linkcheck/plugins/markdowncheck.py +++ b/linkcheck/plugins/markdowncheck.py @@ -78,7 +78,7 @@ class MarkdownCheck(_ContentPlugin): ) def __init__(self, config): - super(MarkdownCheck, self).__init__(config) + super().__init__(config) self.filename_re = self._default_filename_re pattern = config.get(self._filename_re_key) if pattern: diff --git a/linkcheck/plugins/parsepdf.py b/linkcheck/plugins/parsepdf.py index cb56ca74..bdff0f87 100755 --- a/linkcheck/plugins/parsepdf.py +++ b/linkcheck/plugins/parsepdf.py @@ -68,7 +68,7 @@ class PdfParser(_ParserPlugin): """Check for pdfminer.""" if not has_pdflib: log.warn(LOG_PLUGIN, "pdfminer not found for PdfParser plugin") - super(PdfParser, self).__init__(config) + super().__init__(config) def applies_to(self, url_data, pagetype=None): """Check for PDF pagetype.""" diff --git a/linkcheck/plugins/parseword.py b/linkcheck/plugins/parseword.py index 00aabed3..cdb44bbe 100755 --- a/linkcheck/plugins/parseword.py +++ b/linkcheck/plugins/parseword.py @@ -119,7 +119,7 @@ class WordParser(_ParserPlugin): init_win32com() if not has_word(): log.warn(LOG_PLUGIN, "Microsoft Word not found for WordParser plugin") - super(WordParser, self).__init__(config) + super().__init__(config) def applies_to(self, url_data, pagetype=None): """Check for Word pagetype.""" diff --git a/linkcheck/plugins/regexcheck.py b/linkcheck/plugins/regexcheck.py index 1381295d..6b0dc3d6 100644 --- a/linkcheck/plugins/regexcheck.py +++ b/linkcheck/plugins/regexcheck.py @@ -35,7 +35,7 @@ class RegexCheck(_ContentPlugin): def __init__(self, config): """Set warning regex from config.""" - super(RegexCheck, self).__init__(config) + super().__init__(config) self.warningregex = None pattern = config["warningregex"] if pattern: diff --git a/linkcheck/plugins/sslcertcheck.py b/linkcheck/plugins/sslcertcheck.py index f1c2f39e..c143c6e6 100644 --- a/linkcheck/plugins/sslcertcheck.py +++ b/linkcheck/plugins/sslcertcheck.py @@ -37,7 +37,7 @@ class SslCertificateCheck(_ConnectionPlugin): def __init__(self, config): """Initialize clamav configuration.""" - super(SslCertificateCheck, self).__init__(config) + super().__init__(config) self.warn_ssl_cert_secs_valid = ( config[sslcertwarndays] * strformat.SECONDS_PER_DAY ) diff --git a/linkcheck/plugins/syntaxchecks.py b/linkcheck/plugins/syntaxchecks.py index ad41b9b9..c15459a7 100644 --- a/linkcheck/plugins/syntaxchecks.py +++ b/linkcheck/plugins/syntaxchecks.py @@ -50,7 +50,7 @@ class HtmlSyntaxCheck(_ContentPlugin): def __init__(self, config): """Initialize plugin.""" - super(HtmlSyntaxCheck, self).__init__(config) + super().__init__(config) self.timer = W3Timer() def applies_to(self, url_data): @@ -84,7 +84,7 @@ class CssSyntaxCheck(_ContentPlugin): def __init__(self, config): """Initialize plugin.""" - super(CssSyntaxCheck, self).__init__(config) + super().__init__(config) self.timer = W3Timer() def applies_to(self, url_data): diff --git a/linkcheck/plugins/viruscheck.py b/linkcheck/plugins/viruscheck.py index 9093bedb..60be7439 100644 --- a/linkcheck/plugins/viruscheck.py +++ b/linkcheck/plugins/viruscheck.py @@ -29,7 +29,7 @@ class VirusCheck(_ContentPlugin): def __init__(self, config): """Initialize clamav configuration.""" - super(VirusCheck, self).__init__(config) + super().__init__(config) # XXX read config self.clamav_conf = get_clamav_conf(canonical_clamav_conf()) if not self.clamav_conf: @@ -154,7 +154,7 @@ class ClamavConfig(dict): def __init__(self, filename): """Parse clamav configuration file.""" - super(ClamavConfig, self).__init__() + super().__init__() self.parseconf(filename) if self.get('ScannerDaemonOutputFormat'): raise ClamavError(_("ScannerDaemonOutputFormat must be disabled")) diff --git a/linkcheck/threader.py b/linkcheck/threader.py index a9169d20..531e4c22 100644 --- a/linkcheck/threader.py +++ b/linkcheck/threader.py @@ -25,7 +25,7 @@ class StoppableThread(threading.Thread): def __init__(self): """Store stop event.""" - super(StoppableThread, self).__init__() + super().__init__() self._stopper = threading.Event() def stop(self): diff --git a/setup.py b/setup.py index 4a283cbc..68cf990b 100755 --- a/setup.py +++ b/setup.py @@ -102,7 +102,7 @@ class MyInstallLib(install_lib): def install(self): """Install the generated config file.""" - outs = super(MyInstallLib, self).install() + outs = super().install() infile = self.create_conf_file() outfile = os.path.join(self.install_dir, os.path.basename(infile)) self.copy_file(infile, outfile) @@ -149,7 +149,7 @@ class MyInstallLib(install_lib): def get_outputs(self): """Add the generated config file to the list of outputs.""" - outs = super(MyInstallLib, self).get_outputs() + outs = super().get_outputs() conf_output = self.get_conf_output() outs.append(conf_output) if self.compile: @@ -163,7 +163,7 @@ class MyInstallData(install_data): def run(self): """Adjust permissions on POSIX systems.""" self.install_translations() - super(MyInstallData, self).run() + super().run() self.fix_permissions() def install_translations(self): @@ -212,7 +212,7 @@ class MyDistribution(Distribution): def __init__(self, attrs): """Set console and windows scripts.""" - super(MyDistribution, self).__init__(attrs) + super().__init__(attrs) self.console = ["linkchecker"] def run_commands(self): @@ -223,7 +223,7 @@ class MyDistribution(Distribution): data.append("install_data = %r" % cwd) data.append("install_scripts = %r" % cwd) self.create_conf_file(data) - super(MyDistribution, self).run_commands() + super().run_commands() def get_conf_filename(self, directory): """Get name for config file.""" diff --git a/tests/checker/__init__.py b/tests/checker/__init__.py index d7205bb7..e0e50c48 100644 --- a/tests/checker/__init__.py +++ b/tests/checker/__init__.py @@ -59,7 +59,7 @@ class TestLogger(linkcheck.logger._Logger): """ args = self.get_args(kwargs) args["parts"] = self.logparts - super(TestLogger, self).__init__(**args) + super().__init__(**args) # list of expected output lines self.expected = args["expected"] # list of real output lines @@ -204,7 +204,7 @@ class LinkCheckTest(unittest.TestCase): def setUp(self): """Ensure the current locale setting is the default. Otherwise, warnings will get translated and will break tests.""" - super(LinkCheckTest, self).setUp() + super().setUp() linkcheck.init_i18n(loc="C") def norm(self, url, encoding="utf-8"): diff --git a/tests/checker/ftpserver.py b/tests/checker/ftpserver.py index 031f6a43..b1756ef7 100644 --- a/tests/checker/ftpserver.py +++ b/tests/checker/ftpserver.py @@ -32,7 +32,7 @@ class FtpServerTest(LinkCheckTest): def __init__(self, methodName="runTest"): """Init test class and store default ftp server port.""" - super(FtpServerTest, self).__init__(methodName=methodName) + super().__init__(methodName=methodName) self.host = "localhost" self.port = None diff --git a/tests/checker/httpserver.py b/tests/checker/httpserver.py index c5370a7e..a47eb351 100644 --- a/tests/checker/httpserver.py +++ b/tests/checker/httpserver.py @@ -103,7 +103,7 @@ class NoQueryHttpRequestHandler(StoppableHttpRequestHandler): if status >= 200 and status not in (204, 304): self.wfile.write(b"testcontent") else: - super(NoQueryHttpRequestHandler, self).do_GET() + super().do_GET() def do_HEAD(self): """ @@ -114,7 +114,7 @@ class NoQueryHttpRequestHandler(StoppableHttpRequestHandler): self.send_response(self.get_status()) self.end_headers() else: - super(NoQueryHttpRequestHandler, self).do_HEAD() + super().do_HEAD() def list_directory(self, path): """Helper to produce a directory listing (absent index.html). @@ -157,7 +157,7 @@ class HttpServerTest(LinkCheckTest): """ Init test class and store default http server port. """ - super(HttpServerTest, self).__init__(methodName=methodName) + super().__init__(methodName=methodName) self.port = None self.handler = NoQueryHttpRequestHandler @@ -256,7 +256,7 @@ class CookieRedirectHttpRequestHandler(NoQueryHttpRequestHandler): """Send cookie before ending headers.""" self.send_header("Set-Cookie", get_cookie()) self.send_header("Set-Cookie", get_cookie(maxage=0)) - super(CookieRedirectHttpRequestHandler, self).end_headers() + super().end_headers() def redirect(self): """Redirect request.""" @@ -291,7 +291,7 @@ class CookieRedirectHttpRequestHandler(NoQueryHttpRequestHandler): elif "redirect" in self.path: self.redirect() else: - super(CookieRedirectHttpRequestHandler, self).do_GET() + super().do_GET() def do_HEAD(self): """Handle redirections for HEAD.""" @@ -302,7 +302,7 @@ class CookieRedirectHttpRequestHandler(NoQueryHttpRequestHandler): elif "redirect" in self.path: self.redirect() else: - super(CookieRedirectHttpRequestHandler, self).do_HEAD() + super().do_HEAD() class CGIHandler(CGIHTTPRequestHandler, StoppableHttpRequestHandler): diff --git a/tests/checker/telnetserver.py b/tests/checker/telnetserver.py index 1460bd14..4dc42f65 100644 --- a/tests/checker/telnetserver.py +++ b/tests/checker/telnetserver.py @@ -31,7 +31,7 @@ class TelnetServerTest(LinkCheckTest): def __init__(self, methodName="runTest"): """Init test class and store default ftp server port.""" - super(TelnetServerTest, self).__init__(methodName=methodName) + super().__init__(methodName=methodName) self.host = "localhost" self.port = None self.stop_event = threading.Event() diff --git a/tests/checker/test_http.py b/tests/checker/test_http.py index f7b7dc3f..5d53b882 100644 --- a/tests/checker/test_http.py +++ b/tests/checker/test_http.py @@ -25,7 +25,7 @@ class TestHttp(HttpServerTest): """Test http:// link checking.""" def __init__(self, methodName="runTest"): - super(TestHttp, self).__init__(methodName=methodName) + super().__init__(methodName=methodName) self.handler = CookieRedirectHttpRequestHandler @need_network diff --git a/tests/checker/test_http_redirect.py b/tests/checker/test_http_redirect.py index 29f8f9f0..1d18dc39 100644 --- a/tests/checker/test_http_redirect.py +++ b/tests/checker/test_http_redirect.py @@ -24,7 +24,7 @@ class TestHttpRedirect(HttpServerTest): """Test http:// link redirection checking.""" def __init__(self, methodName="runTest"): - super(TestHttpRedirect, self).__init__(methodName=methodName) + super().__init__(methodName=methodName) self.handler = CookieRedirectHttpRequestHandler @need_network diff --git a/tests/checker/test_https.py b/tests/checker/test_https.py index a3220f4d..69b3e947 100644 --- a/tests/checker/test_https.py +++ b/tests/checker/test_https.py @@ -30,7 +30,7 @@ class TestHttps(HttpsServerTest): """ def __init__(self, methodName="runTest"): - super(TestHttps, self).__init__(methodName=methodName) + super().__init__(methodName=methodName) self.handler = CookieRedirectHttpRequestHandler @classmethod diff --git a/tests/checker/test_https_redirect.py b/tests/checker/test_https_redirect.py index f0f09dae..2b21869f 100644 --- a/tests/checker/test_https_redirect.py +++ b/tests/checker/test_https_redirect.py @@ -23,7 +23,7 @@ class TestHttpsRedirect(HttpServerTest): """Test https:// link redirection checking.""" def __init__(self, methodName="runTest"): - super(TestHttpsRedirect, self).__init__(methodName=methodName) + super().__init__(methodName=methodName) self.handler = RedirectHttpsRequestHandler def test_redirect(self):