mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Lots of pylint cleanups
This commit is contained in:
parent
2acf59d781
commit
84f931bb9f
@ -350,7 +350,7 @@ class ChannelDB(plugins.ChannelDBHandler, callbacks.PrivmsgCommandAndRegexp):
|
||||
FROM karma WHERE %s
|
||||
ORDER BY added-subtracted DESC""" % criteria
|
||||
cursor.execute(sql, *args)
|
||||
s = utils.commaAndify(['%s: %s' % (n,t)
|
||||
s = utils.commaAndify(['%s: %s' % (n, t)
|
||||
for (n,t) in cursor.fetchall()])
|
||||
irc.reply(msg, s + '.')
|
||||
else: # No name was given. Return the top/bottom 3 karmas.
|
||||
|
@ -40,7 +40,6 @@ import gzip
|
||||
import sets
|
||||
import getopt
|
||||
import popen2
|
||||
import random
|
||||
import fnmatch
|
||||
import os.path
|
||||
import urllib2
|
||||
|
@ -37,6 +37,7 @@ Enforcer: Enforces capabilities on a channel, watching MODEs, KICKs,
|
||||
import plugins
|
||||
|
||||
import conf
|
||||
import debug
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import privmsgs
|
||||
|
@ -233,7 +233,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
|
||||
capability = ircdb.makeChannelCapability(channel, 'factoids')
|
||||
if ircdb.checkCapability(msg.prefix, capability):
|
||||
cursor = db.cursor()
|
||||
cursor.execute("UPDATE keys SET locked=0 WHERE key LIKE %s",key)
|
||||
cursor.execute("UPDATE keys SET locked=0 WHERE key LIKE %s", key)
|
||||
db.commit()
|
||||
irc.reply(msg, conf.replySuccess)
|
||||
else:
|
||||
|
@ -35,14 +35,17 @@ Provides FreeBSD ports searching and other FreeBSD-specific services.
|
||||
|
||||
import plugins
|
||||
|
||||
import time
|
||||
import string
|
||||
import getopt
|
||||
import os.path
|
||||
import urllib2
|
||||
|
||||
import sqlite
|
||||
|
||||
import conf
|
||||
import debug
|
||||
import utils
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
|
||||
|
@ -35,10 +35,6 @@ Just a regexp module to make the bot a wee bit friendlier.
|
||||
|
||||
import plugins
|
||||
|
||||
import re
|
||||
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import callbacks
|
||||
|
||||
class Friendly(callbacks.PrivmsgRegexp):
|
||||
|
@ -34,30 +34,22 @@ Provides a multitude of fun, useless commands.
|
||||
"""
|
||||
|
||||
import plugins
|
||||
from itertools import imap, ifilter
|
||||
|
||||
import os
|
||||
import gc
|
||||
import re
|
||||
import imp
|
||||
import sys
|
||||
import new
|
||||
import md5
|
||||
import sha
|
||||
import time
|
||||
import socket
|
||||
import string
|
||||
import random
|
||||
import urllib
|
||||
import inspect
|
||||
import telnetlib
|
||||
import threading
|
||||
import mimetypes
|
||||
|
||||
#import conf
|
||||
import debug
|
||||
import utils
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
|
||||
|
@ -35,16 +35,16 @@ Provides fun commands that require a database to operate.
|
||||
|
||||
import plugins
|
||||
|
||||
import re
|
||||
import sets
|
||||
import time
|
||||
import atexit
|
||||
import string
|
||||
import random
|
||||
import os.path
|
||||
|
||||
import sqlite
|
||||
|
||||
import conf
|
||||
import debug
|
||||
import ircdb
|
||||
import utils
|
||||
import world
|
||||
|
@ -40,7 +40,6 @@ import urllib2
|
||||
|
||||
import debug
|
||||
import utils
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
|
@ -46,6 +46,7 @@ import google
|
||||
import conf
|
||||
import utils
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import structures
|
||||
|
@ -37,14 +37,12 @@ import plugins
|
||||
|
||||
import re
|
||||
import sets
|
||||
import time
|
||||
import urllib2
|
||||
|
||||
import utils
|
||||
import debug
|
||||
import privmsgs
|
||||
import callbacks
|
||||
import structures
|
||||
|
||||
example = utils.wrapLines("""
|
||||
<jemfinch> @list Http
|
||||
@ -105,7 +103,7 @@ class Http(callbacks.Privmsg):
|
||||
_fmProject = re.compile('<projectname_full>([^<]+)</projectname_full>')
|
||||
_fmVersion = re.compile('<latest_version>([^<]+)</latest_version>')
|
||||
_fmVitality = re.compile('<vitality_percent>([^<]+)</vitality_percent>')
|
||||
_fmPopular=re.compile('<popularity_percent>([^<]+)</popularity_percent>')
|
||||
_fmPopular = re.compile('<popularity_percent>([^<]+)</popularity_percent>')
|
||||
_fmLastUpdated = re.compile('<date_updated>([^<]+)</date_updated>')
|
||||
def freshmeat(self, irc, msg, args):
|
||||
"""<project name>
|
||||
|
@ -39,7 +39,6 @@ import plugins
|
||||
import IMDb
|
||||
|
||||
import utils
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
|
||||
|
@ -58,7 +58,6 @@ def configure(onStart, afterConnect, advanced):
|
||||
onStart.append('load Markov')
|
||||
|
||||
class Markov(plugins.ChannelDBHandler, callbacks.Privmsg):
|
||||
threaded = True
|
||||
def __init__(self):
|
||||
plugins.ChannelDBHandler.__init__(self)
|
||||
callbacks.Privmsg.__init__(self)
|
||||
@ -120,6 +119,7 @@ class Markov(plugins.ChannelDBHandler, callbacks.Privmsg):
|
||||
return callbacks.Privmsg.doPrivmsg(self, irc, msg)
|
||||
|
||||
_maxMarkovLength = 80
|
||||
_minMarkovLength = 7
|
||||
def markov(self, irc, msg, args):
|
||||
"""[<channel>]
|
||||
|
||||
@ -157,7 +157,10 @@ class Markov(plugins.ChannelDBHandler, callbacks.Privmsg):
|
||||
if word is None:
|
||||
break
|
||||
words.append(word)
|
||||
irc.reply(msg, ' '.join(words))
|
||||
if len(words) < self._minMarkovLength:
|
||||
self.markov(irc, msg, args)
|
||||
else:
|
||||
irc.reply(msg, ' '.join(words))
|
||||
|
||||
def markovpairs(self, irc, msg, args):
|
||||
"""[<channel>]
|
||||
|
@ -44,6 +44,7 @@ from itertools import imap
|
||||
|
||||
import unum.units
|
||||
|
||||
import debug
|
||||
import utils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
@ -214,12 +215,12 @@ class Math(callbacks.Privmsg):
|
||||
try:
|
||||
u1 = eval(unit1.lower(), self._convertEnv, self._convertEnv)
|
||||
except:
|
||||
irc.error(msg, '%s is not a valid units expression.' % units1)
|
||||
irc.error(msg, '%s is not a valid units expression.' % unit1)
|
||||
return
|
||||
try:
|
||||
u2 = eval(unit2.lower(), self._convertEnv, self._convertEnv)
|
||||
except:
|
||||
irc.error(msg, '%s is not a valid units expression.' % units2)
|
||||
irc.error(msg, '%s is not a valid units expression.' % unit2)
|
||||
return
|
||||
try:
|
||||
irc.reply(msg, str((n*u1).as(u2)))
|
||||
|
@ -44,7 +44,6 @@ import sqlite
|
||||
import conf
|
||||
import ircdb
|
||||
import utils
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
|
||||
|
@ -38,7 +38,6 @@ import plugins
|
||||
|
||||
import time
|
||||
import os.path
|
||||
from itertools import imap
|
||||
|
||||
import sqlite
|
||||
|
||||
|
@ -41,8 +41,8 @@ import plugins
|
||||
import conf
|
||||
import utils
|
||||
import ircdb
|
||||
import irclib
|
||||
import ircmsgs
|
||||
import ircutils
|
||||
import privmsgs
|
||||
import callbacks
|
||||
|
||||
|
@ -112,13 +112,8 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
|
||||
maxid = int(cursor.fetchone()[0])
|
||||
if maxid is None:
|
||||
maxid = 0
|
||||
if maxid == 1:
|
||||
IS = 'is'
|
||||
QUOTE = 'quote'
|
||||
else:
|
||||
IS = 'are'
|
||||
QUOTE = 'quotes'
|
||||
s = 'There %s %s %s in my database.' % (IS, maxid, QUOTE)
|
||||
QUOTE = utils.pluralize(maxid, 'quote')
|
||||
s = 'There %s %s %s in my database.' % (utils.be(maxid), maxid, QUOTE)
|
||||
irc.reply(msg, s)
|
||||
|
||||
def quote(self, irc, msg, args):
|
||||
@ -208,7 +203,7 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
|
||||
cursor.execute("""SELECT id FROM quotes
|
||||
ORDER BY random()
|
||||
LIMIT 1""")
|
||||
if cursor.rowcount != 1:
|
||||
if cursor.rowcount != 1:
|
||||
irc.error(msg, 'It seems that quote database is empty.')
|
||||
return
|
||||
(id,) = cursor.fetchone()
|
||||
|
@ -36,13 +36,11 @@ Handles relaying between networks.
|
||||
import plugins
|
||||
|
||||
import re
|
||||
import sets
|
||||
import time
|
||||
|
||||
import conf
|
||||
import debug
|
||||
import utils
|
||||
import ircdb
|
||||
import irclib
|
||||
import drivers
|
||||
import ircmsgs
|
||||
|
@ -39,7 +39,6 @@ import re
|
||||
import time
|
||||
|
||||
import conf
|
||||
import ircdb
|
||||
import ircmsgs
|
||||
import privmsgs
|
||||
import ircutils
|
||||
|
@ -95,7 +95,7 @@ class Status(callbacks.Privmsg):
|
||||
(user, system, childUser, childSystem, elapsed) = os.times()
|
||||
timeRunning = time.time() - world.startedAt
|
||||
activeThreads = threading.activeCount()
|
||||
response ='I have taken %s seconds of user time and %s seconds of '\
|
||||
response = 'I have taken %s seconds of user time and %s seconds of '\
|
||||
'system time, for a total of %s seconds of CPU time. My '\
|
||||
'children have taken %s seconds of user time and %s seconds'\
|
||||
' of system time for a total of %s seconds of CPU time. ' \
|
||||
|
@ -38,6 +38,7 @@ import plugins
|
||||
import re
|
||||
import random
|
||||
|
||||
import conf
|
||||
import debug
|
||||
import utils
|
||||
import ircdb
|
||||
|
Loading…
Reference in New Issue
Block a user