Lots of pylint cleanups

This commit is contained in:
James Vega 2003-10-11 21:03:02 +00:00
parent 2acf59d781
commit 84f931bb9f
22 changed files with 26 additions and 43 deletions

View File

@ -40,7 +40,6 @@ import gzip
import sets import sets
import getopt import getopt
import popen2 import popen2
import random
import fnmatch import fnmatch
import os.path import os.path
import urllib2 import urllib2

View File

@ -37,6 +37,7 @@ Enforcer: Enforces capabilities on a channel, watching MODEs, KICKs,
import plugins import plugins
import conf import conf
import debug
import ircdb import ircdb
import ircmsgs import ircmsgs
import privmsgs import privmsgs

View File

@ -35,14 +35,17 @@ Provides FreeBSD ports searching and other FreeBSD-specific services.
import plugins import plugins
import time
import string import string
import getopt import getopt
import os.path import os.path
import urllib2
import sqlite import sqlite
import conf
import debug import debug
import utils import ircutils
import privmsgs import privmsgs
import callbacks import callbacks

View File

@ -35,10 +35,6 @@ Just a regexp module to make the bot a wee bit friendlier.
import plugins import plugins
import re
import ircmsgs
import ircutils
import callbacks import callbacks
class Friendly(callbacks.PrivmsgRegexp): class Friendly(callbacks.PrivmsgRegexp):

View File

@ -34,30 +34,22 @@ Provides a multitude of fun, useless commands.
""" """
import plugins import plugins
from itertools import imap, ifilter
import os
import gc import gc
import re import re
import imp
import sys import sys
import new
import md5 import md5
import sha import sha
import time
import socket
import string import string
import random import random
import urllib import urllib
import inspect import inspect
import telnetlib
import threading
import mimetypes import mimetypes
#import conf #import conf
import debug import debug
import utils import utils
import ircmsgs import ircutils
import privmsgs import privmsgs
import callbacks import callbacks

View File

@ -35,16 +35,16 @@ Provides fun commands that require a database to operate.
import plugins import plugins
import re
import sets import sets
import time import time
import atexit
import string import string
import random
import os.path import os.path
import sqlite import sqlite
import conf import conf
import debug
import ircdb import ircdb
import utils import utils
import world import world

View File

@ -40,7 +40,6 @@ import urllib2
import debug import debug
import utils import utils
import ircmsgs
import ircutils import ircutils
import privmsgs import privmsgs
import callbacks import callbacks

View File

@ -46,6 +46,7 @@ import google
import conf import conf
import utils import utils
import ircmsgs import ircmsgs
import ircutils
import privmsgs import privmsgs
import callbacks import callbacks
import structures import structures

View File

@ -37,14 +37,12 @@ import plugins
import re import re
import sets import sets
import time
import urllib2 import urllib2
import utils import utils
import debug import debug
import privmsgs import privmsgs
import callbacks import callbacks
import structures
example = utils.wrapLines(""" example = utils.wrapLines("""
<jemfinch> @list Http <jemfinch> @list Http

View File

@ -39,7 +39,6 @@ import plugins
import IMDb import IMDb
import utils import utils
import ircutils
import privmsgs import privmsgs
import callbacks import callbacks

View File

@ -58,7 +58,6 @@ def configure(onStart, afterConnect, advanced):
onStart.append('load Markov') onStart.append('load Markov')
class Markov(plugins.ChannelDBHandler, callbacks.Privmsg): class Markov(plugins.ChannelDBHandler, callbacks.Privmsg):
threaded = True
def __init__(self): def __init__(self):
plugins.ChannelDBHandler.__init__(self) plugins.ChannelDBHandler.__init__(self)
callbacks.Privmsg.__init__(self) callbacks.Privmsg.__init__(self)
@ -120,6 +119,7 @@ class Markov(plugins.ChannelDBHandler, callbacks.Privmsg):
return callbacks.Privmsg.doPrivmsg(self, irc, msg) return callbacks.Privmsg.doPrivmsg(self, irc, msg)
_maxMarkovLength = 80 _maxMarkovLength = 80
_minMarkovLength = 7
def markov(self, irc, msg, args): def markov(self, irc, msg, args):
"""[<channel>] """[<channel>]
@ -157,6 +157,9 @@ class Markov(plugins.ChannelDBHandler, callbacks.Privmsg):
if word is None: if word is None:
break break
words.append(word) words.append(word)
if len(words) < self._minMarkovLength:
self.markov(irc, msg, args)
else:
irc.reply(msg, ' '.join(words)) irc.reply(msg, ' '.join(words))
def markovpairs(self, irc, msg, args): def markovpairs(self, irc, msg, args):

View File

@ -44,6 +44,7 @@ from itertools import imap
import unum.units import unum.units
import debug
import utils import utils
import privmsgs import privmsgs
import callbacks import callbacks
@ -214,12 +215,12 @@ class Math(callbacks.Privmsg):
try: try:
u1 = eval(unit1.lower(), self._convertEnv, self._convertEnv) u1 = eval(unit1.lower(), self._convertEnv, self._convertEnv)
except: except:
irc.error(msg, '%s is not a valid units expression.' % units1) irc.error(msg, '%s is not a valid units expression.' % unit1)
return return
try: try:
u2 = eval(unit2.lower(), self._convertEnv, self._convertEnv) u2 = eval(unit2.lower(), self._convertEnv, self._convertEnv)
except: except:
irc.error(msg, '%s is not a valid units expression.' % units2) irc.error(msg, '%s is not a valid units expression.' % unit2)
return return
try: try:
irc.reply(msg, str((n*u1).as(u2))) irc.reply(msg, str((n*u1).as(u2)))

View File

@ -44,7 +44,6 @@ import sqlite
import conf import conf
import ircdb import ircdb
import utils import utils
import ircutils
import privmsgs import privmsgs
import callbacks import callbacks

View File

@ -38,7 +38,6 @@ import plugins
import time import time
import os.path import os.path
from itertools import imap
import sqlite import sqlite

View File

@ -41,8 +41,8 @@ import plugins
import conf import conf
import utils import utils
import ircdb import ircdb
import irclib
import ircmsgs import ircmsgs
import ircutils
import privmsgs import privmsgs
import callbacks import callbacks

View File

@ -112,13 +112,8 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
maxid = int(cursor.fetchone()[0]) maxid = int(cursor.fetchone()[0])
if maxid is None: if maxid is None:
maxid = 0 maxid = 0
if maxid == 1: QUOTE = utils.pluralize(maxid, 'quote')
IS = 'is' s = 'There %s %s %s in my database.' % (utils.be(maxid), maxid, QUOTE)
QUOTE = 'quote'
else:
IS = 'are'
QUOTE = 'quotes'
s = 'There %s %s %s in my database.' % (IS, maxid, QUOTE)
irc.reply(msg, s) irc.reply(msg, s)
def quote(self, irc, msg, args): def quote(self, irc, msg, args):

View File

@ -36,13 +36,11 @@ Handles relaying between networks.
import plugins import plugins
import re import re
import sets
import time import time
import conf import conf
import debug import debug
import utils import utils
import ircdb
import irclib import irclib
import drivers import drivers
import ircmsgs import ircmsgs

View File

@ -39,7 +39,6 @@ import re
import time import time
import conf import conf
import ircdb
import ircmsgs import ircmsgs
import privmsgs import privmsgs
import ircutils import ircutils

View File

@ -38,6 +38,7 @@ import plugins
import re import re
import random import random
import conf
import debug import debug
import utils import utils
import ircdb import ircdb