mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +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
|
FROM karma WHERE %s
|
||||||
ORDER BY added-subtracted DESC""" % criteria
|
ORDER BY added-subtracted DESC""" % criteria
|
||||||
cursor.execute(sql, *args)
|
cursor.execute(sql, *args)
|
||||||
s = utils.commaAndify(['%s: %s' % (n,t)
|
s = utils.commaAndify(['%s: %s' % (n, t)
|
||||||
for (n,t) in cursor.fetchall()])
|
for (n,t) in cursor.fetchall()])
|
||||||
irc.reply(msg, s + '.')
|
irc.reply(msg, s + '.')
|
||||||
else: # No name was given. Return the top/bottom 3 karmas.
|
else: # No name was given. Return the top/bottom 3 karmas.
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -233,7 +233,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||||||
capability = ircdb.makeChannelCapability(channel, 'factoids')
|
capability = ircdb.makeChannelCapability(channel, 'factoids')
|
||||||
if ircdb.checkCapability(msg.prefix, capability):
|
if ircdb.checkCapability(msg.prefix, capability):
|
||||||
cursor = db.cursor()
|
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()
|
db.commit()
|
||||||
irc.reply(msg, conf.replySuccess)
|
irc.reply(msg, conf.replySuccess)
|
||||||
else:
|
else:
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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):
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
@ -105,7 +103,7 @@ class Http(callbacks.Privmsg):
|
|||||||
_fmProject = re.compile('<projectname_full>([^<]+)</projectname_full>')
|
_fmProject = re.compile('<projectname_full>([^<]+)</projectname_full>')
|
||||||
_fmVersion = re.compile('<latest_version>([^<]+)</latest_version>')
|
_fmVersion = re.compile('<latest_version>([^<]+)</latest_version>')
|
||||||
_fmVitality = re.compile('<vitality_percent>([^<]+)</vitality_percent>')
|
_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>')
|
_fmLastUpdated = re.compile('<date_updated>([^<]+)</date_updated>')
|
||||||
def freshmeat(self, irc, msg, args):
|
def freshmeat(self, irc, msg, args):
|
||||||
"""<project name>
|
"""<project name>
|
||||||
|
@ -39,7 +39,6 @@ import plugins
|
|||||||
import IMDb
|
import IMDb
|
||||||
|
|
||||||
import utils
|
import utils
|
||||||
import ircutils
|
|
||||||
import privmsgs
|
import privmsgs
|
||||||
import callbacks
|
import callbacks
|
||||||
|
|
||||||
|
@ -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,7 +157,10 @@ class Markov(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||||||
if word is None:
|
if word is None:
|
||||||
break
|
break
|
||||||
words.append(word)
|
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):
|
def markovpairs(self, irc, msg, args):
|
||||||
"""[<channel>]
|
"""[<channel>]
|
||||||
|
@ -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)))
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@ import plugins
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
import os.path
|
import os.path
|
||||||
from itertools import imap
|
|
||||||
|
|
||||||
import sqlite
|
import sqlite
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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):
|
||||||
@ -208,7 +203,7 @@ class Quotes(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||||||
cursor.execute("""SELECT id FROM quotes
|
cursor.execute("""SELECT id FROM quotes
|
||||||
ORDER BY random()
|
ORDER BY random()
|
||||||
LIMIT 1""")
|
LIMIT 1""")
|
||||||
if cursor.rowcount != 1:
|
if cursor.rowcount != 1:
|
||||||
irc.error(msg, 'It seems that quote database is empty.')
|
irc.error(msg, 'It seems that quote database is empty.')
|
||||||
return
|
return
|
||||||
(id,) = cursor.fetchone()
|
(id,) = cursor.fetchone()
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -95,7 +95,7 @@ class Status(callbacks.Privmsg):
|
|||||||
(user, system, childUser, childSystem, elapsed) = os.times()
|
(user, system, childUser, childSystem, elapsed) = os.times()
|
||||||
timeRunning = time.time() - world.startedAt
|
timeRunning = time.time() - world.startedAt
|
||||||
activeThreads = threading.activeCount()
|
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 '\
|
'system time, for a total of %s seconds of CPU time. My '\
|
||||||
'children have taken %s seconds of user time and %s seconds'\
|
'children have taken %s seconds of user time and %s seconds'\
|
||||||
' of system time for a total of %s seconds of CPU time. ' \
|
' of system time for a total of %s seconds of CPU time. ' \
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user