Fix errors found by Pylint

Remove code for old-style classes:
better_exchook2.py:238:62: E1101: Module 'types' has no 'InstanceType' member (no-member)

Command-line equivalent of 9a33c2a65 ("Make requesting login form password work on Python 3", 2020-04-14):
command/setup_config.py:167:36: E1101: Module 'linkcheck.director.console' has no 'encode' member (no-member)

Add missing argument:
plugins/parseword.py:141:31: E1120: No value for argument 'wrange' in function call (no-value-for-parameter)
This commit is contained in:
Chris Mayo 2023-05-03 19:24:53 +01:00
parent 60c4e7b671
commit 1341ee92bc
3 changed files with 3 additions and 6 deletions

View file

@ -234,9 +234,7 @@ def better_exchook(etype, value, tb, out=sys.stdout):
else:
line = f"{etype}: {valuestr}"
return line
if (isinstance(etype, BaseException) or
(hasattr(types, "InstanceType") and isinstance(etype, types.InstanceType)) or
etype is None or type(etype) is str):
if isinstance(etype, BaseException) or etype is None or type(etype) is str:
output(_format_final_exc_line(etype, value), out=out)
else:
output(_format_final_exc_line(etype.__name__, value), out=out)

View file

@ -28,7 +28,6 @@ from .. import LOG_CMDLINE
from .. import get_link_pat, log
from ..cmdline import print_version, print_usage, print_plugins
from ..director import console
def has_encoding(encoding):
@ -164,7 +163,7 @@ def setup_config(config, options):
}
else:
msg = _("Enter LinkChecker HTTP/FTP password:")
_password = getpass.getpass(console.encode(msg))
_password = getpass.getpass(msg)
constructauth = True
if options.quiet:
config["logger"] = config.logger_new("none")

View file

@ -138,7 +138,7 @@ class WordParser(_ParserPlugin):
raise Error("could not open word file %r" % filename)
try:
for link in doc.Hyperlinks:
line = get_line_number(link.Range)
line = get_line_number(doc, link.Range)
name = link.TextToDisplay
url_data.add_url(link.Address, name=name, line=line)
finally: