From cafd724d307c6c532339a9b7b6bcfffb37fe03a7 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 11 Aug 2004 13:51:15 +0000 Subject: [PATCH] PyChecker fixes. --- src/Admin.py | 32 -------------------------------- src/Config.py | 1 - src/Misc.py | 2 +- src/Owner.py | 18 +----------------- src/asyncoreDrivers.py | 5 ----- src/socketDrivers.py | 2 -- src/structures.py | 3 --- src/world.py | 1 - 8 files changed, 2 insertions(+), 62 deletions(-) diff --git a/src/Admin.py b/src/Admin.py index 6295c16e0..53da230cd 100755 --- a/src/Admin.py +++ b/src/Admin.py @@ -41,10 +41,6 @@ import supybot.fix as fix import time import pprint -import string -import logging -import smtplib -import textwrap from itertools import imap import supybot.log as log @@ -387,34 +383,6 @@ class Admin(privmsgs.CapabilityCheckingPrivmsg): else: irc.reply('I\'m not currently globally ignoring anyone.') - def reportbug(self, irc, msg, args): - """ - - Reports a bug to a private mailing list supybot-bugs. - will be the subject of the email. The most recent 10 or so messages - the bot receives will be sent in the body of the email. - """ - description = privmsgs.getArgs(args) - messages = pprint.pformat(irc.state.history[-10:]) - email = textwrap.dedent(""" - Subject: %s - From: jemfinch@users.sourceforge.net - To: supybot-bugs@lists.sourceforge.net - Date: %s - - Bug report for Supybot %s. - %s - """) % (description, time.ctime(), conf.version, messages) - email = email.strip() - email = email.replace('\n', '\r\n') - smtp = smtplib.SMTP('mail.sourceforge.net', 25) - smtp.sendmail('jemfinch@users.sf.net', - ['supybot-bugs@lists.sourceforge.net'], - email) - smtp.quit() - irc.replySuccess() - reportbug = privmsgs.thread(reportbug) - Class = Admin diff --git a/src/Config.py b/src/Config.py index 1ef44752e..4a44f0ebe 100644 --- a/src/Config.py +++ b/src/Config.py @@ -42,7 +42,6 @@ import supybot.conf as conf import supybot.utils as utils import supybot.world as world import supybot.ircdb as ircdb -import supybot.plugins as plugins import supybot.ircutils as ircutils import supybot.privmsgs as privmsgs import supybot.registry as registry diff --git a/src/Misc.py b/src/Misc.py index c6fa9da56..8a096bbcb 100755 --- a/src/Misc.py +++ b/src/Misc.py @@ -191,7 +191,7 @@ class Misc(callbacks.Privmsg): return name = privmsgs.getArgs(args) cb = irc.getCallback(name) - if cb is not None and cb.__doc__ and not getattr(cb, '_original'): + if cb is not None and cb.__doc__ and not hasattr(cb, '_original'): irc.reply(utils.normalizeWhitespace(cb.__doc__)) return command = callbacks.canonicalName(name) diff --git a/src/Owner.py b/src/Owner.py index d01be8b99..c8c4aa9dd 100644 --- a/src/Owner.py +++ b/src/Owner.py @@ -43,7 +43,6 @@ import gc import os import imp import sys -import sets import getopt import logging import linecache @@ -54,7 +53,6 @@ import supybot.utils as utils import supybot.world as world import supybot.ircdb as ircdb import supybot.ircmsgs as ircmsgs -import supybot.drivers as drivers import supybot.ircutils as ircutils import supybot.privmsgs as privmsgs import supybot.registry as registry @@ -174,18 +172,6 @@ class LogProxy(object): return getattr(self.log, attr) -class LogErrorHandler(logging.Handler): - irc = None - def handle(self, record): - if record.levelno >= logging.ERROR: - if record.exc_info: - (_, e, _) = record.exc_info - s = 'Uncaught exception in %s: %s' % (record.module, e) - else: - s = record.msg - # Send to the owner dudes. - - class Owner(privmsgs.CapabilityCheckingPrivmsg): # This plugin must be first; its priority must be lowest; otherwise odd # things will happen when adding callbacks. @@ -241,9 +227,7 @@ class Owner(privmsgs.CapabilityCheckingPrivmsg): self.log.error('Error loading src/ plugin %s. ' 'This is usually rather ' 'serious; these plugins are ' - 'almost always be loaded.', - name) - + 'almost always be loaded.',name) except Exception, e: log.exception('Failed to load %s:', name) else: diff --git a/src/asyncoreDrivers.py b/src/asyncoreDrivers.py index 673c34654..e266f1607 100644 --- a/src/asyncoreDrivers.py +++ b/src/asyncoreDrivers.py @@ -33,25 +33,20 @@ __revision__ = "$Id$" import supybot.fix as fix -import re import sys import time import socket import asyncore import asynchat -import supybot.log as log import supybot.conf as conf -import supybot.ircdb as ircdb import supybot.utils as utils import supybot.world as world import supybot.drivers as drivers -import supybot.ircmsgs as ircmsgs import supybot.schedule as schedule class AsyncoreRunnerDriver(drivers.IrcDriver): def run(self): - #log.debug(repr(asyncore.socket_map)) try: timeout = conf.supybot.drivers.poll() if not asyncore.socket_map: diff --git a/src/socketDrivers.py b/src/socketDrivers.py index f1ebf9504..5643e0c91 100644 --- a/src/socketDrivers.py +++ b/src/socketDrivers.py @@ -40,7 +40,6 @@ __revision__ ="$Id$" import supybot.fix as fix import time -import atexit import select import socket from itertools import imap @@ -50,7 +49,6 @@ import supybot.conf as conf import supybot.utils as utils import supybot.world as world import supybot.drivers as drivers -import supybot.ircmsgs as ircmsgs import supybot.schedule as schedule reconnectWaits = (0, 60, 300) diff --git a/src/structures.py b/src/structures.py index c61aea970..e6a998d10 100644 --- a/src/structures.py +++ b/src/structures.py @@ -38,9 +38,6 @@ __revision__ = "$Id$" import supybot.fix as fix import types -import pprint -import string -import threading from itertools import imap class RingBuffer(object): diff --git a/src/world.py b/src/world.py index 6ba5d1020..bf43b6110 100644 --- a/src/world.py +++ b/src/world.py @@ -42,7 +42,6 @@ import os import sys import sre import time -import types import atexit import threading