mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 05:09:23 +01:00
Made some changes to satisfy PyChecker.
This commit is contained in:
parent
dcacf9c7d5
commit
7fd35a1071
@ -47,7 +47,6 @@ import sha
|
|||||||
import time
|
import time
|
||||||
import math
|
import math
|
||||||
import cmath
|
import cmath
|
||||||
import types
|
|
||||||
import string
|
import string
|
||||||
import random
|
import random
|
||||||
import urllib
|
import urllib
|
||||||
|
@ -116,7 +116,7 @@ class Infobot(callbacks.PrivmsgRegexp):
|
|||||||
self.db.commit()
|
self.db.commit()
|
||||||
|
|
||||||
def forget(self, irc, msg, match):
|
def forget(self, irc, msg, match):
|
||||||
r"^forget\s+(.+?)(?![?.! ]*)$"
|
r"^forget\s+(.+?)(?!\?+)[?.! ]*$"
|
||||||
key = match.group(1)
|
key = match.group(1)
|
||||||
cursor = self.db.cursor()
|
cursor = self.db.cursor()
|
||||||
cursor.execute('DELETE FROM is_factoids WHERE key=%s', key)
|
cursor.execute('DELETE FROM is_factoids WHERE key=%s', key)
|
||||||
@ -128,7 +128,7 @@ class Infobot(callbacks.PrivmsgRegexp):
|
|||||||
(nick, key) = match.groups()
|
(nick, key) = match.groups()
|
||||||
try:
|
try:
|
||||||
s = '%s wants you to know that %s' %(msg.nick,self.getFactoid(key))
|
s = '%s wants you to know that %s' %(msg.nick,self.getFactoid(key))
|
||||||
irc.queueMsg(irmcsgs.privmsg(nick, s))
|
irc.queueMsg(ircmsgs.privmsg(nick, s))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.reply(msg, 'I don\'t know anything about %s' % key)
|
irc.reply(msg, 'I don\'t know anything about %s' % key)
|
||||||
|
|
||||||
@ -157,7 +157,6 @@ class Infobot(callbacks.PrivmsgRegexp):
|
|||||||
key = match.group(1)
|
key = match.group(1)
|
||||||
try:
|
try:
|
||||||
irc.reply(msg, self.getFactoid(key))
|
irc.reply(msg, self.getFactoid(key))
|
||||||
#irc.queueMsg(ircmsgs.privmsg(msg.args[0], self.getFactoid(key)))
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
irc.reply(msg, self.getRandomSaying('dont_knows'))
|
irc.reply(msg, self.getRandomSaying('dont_knows'))
|
||||||
|
|
||||||
@ -165,9 +164,9 @@ class Infobot(callbacks.PrivmsgRegexp):
|
|||||||
r"^info$"
|
r"^info$"
|
||||||
cursor = self.db.cursor()
|
cursor = self.db.cursor()
|
||||||
cursor.execute("SELECT COUNT(*) FROM is_factoids")
|
cursor.execute("SELECT COUNT(*) FROM is_factoids")
|
||||||
numIs = self.cursor.fetchone()[0]
|
numIs = cursor.fetchone()[0]
|
||||||
cursor.execute("SELECT COUNT(*) FROM are_factoids")
|
cursor.execute("SELECT COUNT(*) FROM are_factoids")
|
||||||
numAre = self.cursor.fetchone()[0]
|
numAre = cursor.fetchone()[0]
|
||||||
s = 'I have %s is factoids and %s are factoids' % (numIs, numAre)
|
s = 'I have %s is factoids and %s are factoids' % (numIs, numAre)
|
||||||
irc.reply(msg, s)
|
irc.reply(msg, s)
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@ Removes all bold output by the bot.
|
|||||||
from baseplugin import *
|
from baseplugin import *
|
||||||
|
|
||||||
import ircmsgs
|
import ircmsgs
|
||||||
import privmsgs
|
|
||||||
import callbacks
|
import callbacks
|
||||||
|
|
||||||
|
|
||||||
|
@ -118,7 +118,6 @@ class Moobot(callbacks.Privmsg):
|
|||||||
"""
|
"""
|
||||||
text = privmsgs.getArgs(args)
|
text = privmsgs.getArgs(args)
|
||||||
text = text.replace('_', '-')
|
text = text.replace('_', '-')
|
||||||
L = []
|
|
||||||
def morseToLetter(m):
|
def morseToLetter(m):
|
||||||
s = m.group(1)
|
s = m.group(1)
|
||||||
return self._revcode.get(s, s)
|
return self._revcode.get(s, s)
|
||||||
|
@ -69,6 +69,7 @@ class News(callbacks.Privmsg, ChannelDBHandler):
|
|||||||
added_by TEXT
|
added_by TEXT
|
||||||
)""")
|
)""")
|
||||||
db.commit()
|
db.commit()
|
||||||
|
return db
|
||||||
|
|
||||||
def addnews(self, irc, msg, args):
|
def addnews(self, irc, msg, args):
|
||||||
"""[<channel>] <expires> <text>
|
"""[<channel>] <expires> <text>
|
||||||
|
@ -44,16 +44,11 @@ And you'll be able to call the command like this:
|
|||||||
slashdot
|
slashdot
|
||||||
|
|
||||||
Also includes a function for getting info about a specific feed, rssinfo.
|
Also includes a function for getting info about a specific feed, rssinfo.
|
||||||
|
|
||||||
Commands include:
|
|
||||||
rsstitles
|
|
||||||
rssinfo
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from baseplugin import *
|
from baseplugin import *
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import operator
|
|
||||||
|
|
||||||
import rssparser
|
import rssparser
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import os, sys, os.path, shutil
|
import os, os.path
|
||||||
|
|
||||||
def removeFiles(arg, dirname, names):
|
def removeFiles(_, dirname, names):
|
||||||
for name in names:
|
for name in names:
|
||||||
if name[-4:] in ('.pyc', 'pyo'):
|
if name[-4:] in ('.pyc', 'pyo'):
|
||||||
os.remove(os.path.join(dirname, name))
|
os.remove(os.path.join(dirname, name))
|
||||||
|
@ -190,9 +190,9 @@ class MiscCommands(callbacks.Privmsg):
|
|||||||
Returns the module <command> is in.
|
Returns the module <command> is in.
|
||||||
"""
|
"""
|
||||||
command = callbacks.canonicalName(privmsgs.getArgs(args))
|
command = callbacks.canonicalName(privmsgs.getArgs(args))
|
||||||
Class = irc.findCallback(command)
|
cb = irc.findCallback(command)
|
||||||
if Class is not None:
|
if cb is not None:
|
||||||
irc.reply(msg, Class.name())
|
irc.reply(msg, cb.name())
|
||||||
else:
|
else:
|
||||||
irc.error(msg, 'There is no such command %s' % command)
|
irc.error(msg, 'There is no such command %s' % command)
|
||||||
|
|
||||||
|
@ -45,7 +45,6 @@ import ircdb
|
|||||||
import world
|
import world
|
||||||
import drivers
|
import drivers
|
||||||
import ircmsgs
|
import ircmsgs
|
||||||
import ircutils
|
|
||||||
import schedule
|
import schedule
|
||||||
|
|
||||||
class AsyncoreRunnerDriver(drivers.IrcDriver):
|
class AsyncoreRunnerDriver(drivers.IrcDriver):
|
||||||
|
@ -178,9 +178,8 @@ def main():
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
import sys
|
|
||||||
if '-p' in sys.argv:
|
if '-p' in sys.argv:
|
||||||
import profile, time
|
import profile
|
||||||
sys.argv.remove('-p')
|
sys.argv.remove('-p')
|
||||||
profile.run('main()', '%i.prof' % time.time())
|
profile.run('main()', '%i.prof' % time.time())
|
||||||
if '-O' in sys.argv:
|
if '-O' in sys.argv:
|
||||||
|
@ -51,7 +51,7 @@ class HtmlToText(sgmllib.SGMLParser):
|
|||||||
self.tagReplace = tagReplace
|
self.tagReplace = tagReplace
|
||||||
sgmllib.SGMLParser.__init__(self)
|
sgmllib.SGMLParser.__init__(self)
|
||||||
|
|
||||||
def unknown_starttag(self, tag, attrib):
|
def unknown_starttag(self, tag, attr):
|
||||||
self.data.append(self.tagReplace)
|
self.data.append(self.tagReplace)
|
||||||
|
|
||||||
def unknown_endtag(self, tag):
|
def unknown_endtag(self, tag):
|
||||||
|
@ -37,7 +37,6 @@ sys.path.insert(0, 'plugins')
|
|||||||
from fix import *
|
from fix import *
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import sys
|
|
||||||
import glob
|
import glob
|
||||||
import time
|
import time
|
||||||
import os.path
|
import os.path
|
||||||
@ -141,11 +140,11 @@ class PluginTestCase(unittest.TestCase):
|
|||||||
|
|
||||||
def assertRegexps(self, query, regexps):
|
def assertRegexps(self, query, regexps):
|
||||||
started = time.time()
|
started = time.time()
|
||||||
total = len(expectedResponses)*self.timeout
|
total = len(regexps)*self.timeout
|
||||||
while expectedResponses and time.time() - started < total:
|
while regexps and time.time() - started < total:
|
||||||
m = self._feedMsg(query)
|
m = self._feedMsg(query)
|
||||||
self.failUnless(m, msg)
|
self.failUnless(m, msg)
|
||||||
regepx = expectedResponses.pop(0)
|
regexp = regexps.pop(0)
|
||||||
self.failUnless(re.search(regexp, m.args[1]),
|
self.failUnless(re.search(regexp, m.args[1]),
|
||||||
'%r does not match %r' % (m.args[1], regexp))
|
'%r does not match %r' % (m.args[1], regexp))
|
||||||
self.failIf(time.time() - started > total)
|
self.failIf(time.time() - started > total)
|
||||||
|
@ -33,8 +33,6 @@
|
|||||||
|
|
||||||
from test import *
|
from test import *
|
||||||
|
|
||||||
import pickle
|
|
||||||
|
|
||||||
class FunctionsTest(unittest.TestCase):
|
class FunctionsTest(unittest.TestCase):
|
||||||
def testCatch(self):
|
def testCatch(self):
|
||||||
def f():
|
def f():
|
||||||
@ -46,7 +44,7 @@ class FunctionsTest(unittest.TestCase):
|
|||||||
revL = list(reviter(L))
|
revL = list(reviter(L))
|
||||||
L.reverse()
|
L.reverse()
|
||||||
self.assertEqual(L, revL, 'reviter didn\'t return reversed list')
|
self.assertEqual(L, revL, 'reviter didn\'t return reversed list')
|
||||||
for elt in reviter([]):
|
for _ in reviter([]):
|
||||||
self.fail('reviter caused iteration over empty sequence')
|
self.fail('reviter caused iteration over empty sequence')
|
||||||
|
|
||||||
def testGroup(self):
|
def testGroup(self):
|
||||||
|
@ -35,7 +35,6 @@ import os
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import conf
|
import conf
|
||||||
import debug
|
|
||||||
import ircdb
|
import ircdb
|
||||||
import ircutils
|
import ircutils
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
from test import *
|
from test import *
|
||||||
|
|
||||||
import copy
|
|
||||||
import pickle
|
import pickle
|
||||||
|
|
||||||
import conf
|
import conf
|
||||||
|
@ -47,7 +47,8 @@ class IrcMsgTestCase(unittest.TestCase):
|
|||||||
strmsg.replace(':', '') == strmsg)
|
strmsg.replace(':', '') == strmsg)
|
||||||
|
|
||||||
def testRepr(self):
|
def testRepr(self):
|
||||||
from ircmsgs import IrcMsg
|
IrcMsg = ircmsgs.IrcMsg
|
||||||
|
ignore(IrcMsg) # Make pychecker happy.
|
||||||
for msg in msgs:
|
for msg in msgs:
|
||||||
self.assertEqual(msg, eval(repr(msg)))
|
self.assertEqual(msg, eval(repr(msg)))
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ class RingBufferTestCase(unittest.TestCase):
|
|||||||
self.assertRaises(ValueError, b.__setitem__, slice(0, 10), [])
|
self.assertRaises(ValueError, b.__setitem__, slice(0, 10), [])
|
||||||
b[2:4] = L[2:4]
|
b[2:4] = L[2:4]
|
||||||
self.assertEquals(b[2:4], L[2:4])
|
self.assertEquals(b[2:4], L[2:4])
|
||||||
for i in range(len(b)):
|
for _ in range(len(b)):
|
||||||
b.append(0)
|
b.append(0)
|
||||||
b[2:4] = L[2:4]
|
b[2:4] = L[2:4]
|
||||||
self.assertEquals(b[2:4], L[2:4])
|
self.assertEquals(b[2:4], L[2:4])
|
||||||
|
@ -141,16 +141,16 @@ usesInput = 1
|
|||||||
usesExec = 0
|
usesExec = 0
|
||||||
|
|
||||||
# ignore warnings from files under standard library
|
# ignore warnings from files under standard library
|
||||||
ignoreStandardLibrary = 0
|
ignoreStandardLibrary = 1
|
||||||
|
|
||||||
# ignore warnings from the list of modules
|
# ignore warnings from the list of modules
|
||||||
blacklist = ['Tkinter', 'wxPython', 'gtk', 'GTK', 'GDK', 'asynchat']
|
blacklist = ['Tkinter', 'wxPython', 'gtk', 'GTK', 'GDK', 'asynchat']
|
||||||
|
|
||||||
# ignore global variables not used if name is one of these values
|
# ignore global variables not used if name is one of these values
|
||||||
variablesToIgnore = ['__version__', '__warningregistry__', '__all__', '__credits__', '__author__', '__email__']
|
variablesToIgnore = ['__version__', '__warningregistry__', '__all__', '__credits__', '__author__', '__email__',]
|
||||||
|
|
||||||
# ignore unused locals/arguments if name is one of these values
|
# ignore unused locals/arguments if name is one of these values
|
||||||
unusedNames = ['_', 'empty', 'unused', 'dummy', 'irc', 'args', 'msg', 'match']
|
unusedNames = ['_', 'empty', 'unused', 'dummy', 'irc', 'args', 'msg', 'match', 'afterConnect', 'onStart', 'advanced', 'yn', 'expect', 'anything', 'something',]
|
||||||
|
|
||||||
# ignore use of deprecated modules/functions
|
# ignore use of deprecated modules/functions
|
||||||
deprecated = 1
|
deprecated = 1
|
||||||
|
Loading…
Reference in New Issue
Block a user