Code cleanup: indentation, unused variables etc.

This commit is contained in:
Bastian Kleineidam 2011-05-15 18:36:30 +02:00
parent 581da4a9c6
commit 343cf9703d
5 changed files with 11 additions and 12 deletions

View file

@ -72,7 +72,7 @@ class NntpUrl (urlbase.UrlBase):
later", are caught.
"""
tries = 0
nntp = value = None
nntp = None
while tries < 2:
tries += 1
try:

View file

@ -433,8 +433,8 @@ class UrlBase (object):
return
# check for obfuscated IP address
if iputil.is_obfuscated_ip(self.host):
ips = iputil.resolve_host(self.host)
if ips:
ips = iputil.resolve_host(self.host)
if ips:
self.add_warning(
_("URL %(url)s has obfuscated IP address %(ip)s") % \
{"url": self.base_url, "ip": ips.pop()},

View file

@ -327,7 +327,7 @@ class Configuration (dict):
"""Make anchor configuration consistent."""
if not self["warnings"]:
self["warnings"] = True
from ..checker import Warnings
from ..checker.const import Warnings
self["ignorewarnings"] = Warnings.keys()
if 'url-anchor-not-found' in self["ignorewarnings"]:
self["ignorewarnings"].remove('url-anchor-not-found')
@ -432,9 +432,9 @@ def get_standard_config_files ():
if not os.path.exists(userdir):
os.makedirs(userdir)
shutil.copy(syspath, userpath)
except StandardError, msg:
except StandardError:
log.warn(LOG_CHECK, "could not copy system config from %r to %r",
syspath, userpath)
syspath, userpath, traceback=True)
return (syspath, userpath)
@ -633,7 +633,7 @@ def add_kde_setting (key, value, data):
elif key == "Proxy Config Script":
data["autoconfig_url"] = value
elif key == "httpProxy":
add_kde_proxy("http_proxy", value, data)
add_kde_proxy("http_proxy", value, data)
elif key == "httpsProxy":
add_kde_proxy("https_proxy", value, data)
elif key == "ftpProxy":

View file

@ -71,9 +71,9 @@ if hasattr(httplib, 'HTTPS'):
class HttpsWithGzipHandler (urllib2.HTTPSHandler):
"""Support gzip encoding."""
def http_open (self, req):
def https_open (self, req):
"""Send request and decode answer."""
return decode(urllib2.HTTPSHandler.http_open(self, req))
return decode(urllib2.HTTPSHandler.https_open(self, req))
# end of urlutils.py routines
###########################################################################

View file

@ -27,7 +27,8 @@ import os
import pprint
import socket
import optparse
import getpass
# installs _() and _n() gettext functions into global namespace
import linkcheck
# override optparse gettext method with the one from linkcheck.init_i18n()
optparse._ = _
@ -657,7 +658,6 @@ if options.password:
{"user": _username}
else:
msg = _("Enter LinkChecker HTTP/FTP password:")
import getpass
_password = getpass.getpass(console.encode(msg))
constructauth = True
if options.pause is not None:
@ -723,7 +723,6 @@ for entry in config["authentication"]:
attrs["strpattern"] = attrs["pattern"].pattern
msg = _("Enter LinkChecker password for user %(user)s" \
" at %(strpattern)s:") % attrs
import getpass
entry["password"] = getpass.getpass(console.encode(msg))
# now sanitize the configuration
config.sanitize()