mirror of
				https://github.com/Mikaela/Limnoria.git
				synced 2025-10-31 07:37:22 +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 math | ||||
| import cmath | ||||
| import types | ||||
| import string | ||||
| import random | ||||
| import urllib | ||||
|  | ||||
| @ -116,7 +116,7 @@ class Infobot(callbacks.PrivmsgRegexp): | ||||
|         self.db.commit() | ||||
| 
 | ||||
|     def forget(self, irc, msg, match): | ||||
|         r"^forget\s+(.+?)(?![?.! ]*)$" | ||||
|         r"^forget\s+(.+?)(?!\?+)[?.! ]*$" | ||||
|         key = match.group(1) | ||||
|         cursor = self.db.cursor() | ||||
|         cursor.execute('DELETE FROM is_factoids WHERE key=%s', key) | ||||
| @ -128,7 +128,7 @@ class Infobot(callbacks.PrivmsgRegexp): | ||||
|         (nick, key) = match.groups() | ||||
|         try: | ||||
|             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: | ||||
|             irc.reply(msg, 'I don\'t know anything about %s' % key) | ||||
|          | ||||
| @ -157,7 +157,6 @@ class Infobot(callbacks.PrivmsgRegexp): | ||||
|         key = match.group(1) | ||||
|         try: | ||||
|             irc.reply(msg, self.getFactoid(key)) | ||||
|             #irc.queueMsg(ircmsgs.privmsg(msg.args[0], self.getFactoid(key))) | ||||
|         except KeyError: | ||||
|             irc.reply(msg, self.getRandomSaying('dont_knows')) | ||||
| 
 | ||||
| @ -165,9 +164,9 @@ class Infobot(callbacks.PrivmsgRegexp): | ||||
|         r"^info$" | ||||
|         cursor = self.db.cursor() | ||||
|         cursor.execute("SELECT COUNT(*) FROM is_factoids") | ||||
|         numIs = self.cursor.fetchone()[0] | ||||
|         numIs = cursor.fetchone()[0] | ||||
|         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) | ||||
|         irc.reply(msg, s) | ||||
|                    | ||||
|  | ||||
| @ -36,7 +36,6 @@ Removes all bold output by the bot. | ||||
| from baseplugin import * | ||||
| 
 | ||||
| import ircmsgs | ||||
| import privmsgs | ||||
| import callbacks | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -118,7 +118,6 @@ class Moobot(callbacks.Privmsg): | ||||
|         """ | ||||
|         text = privmsgs.getArgs(args) | ||||
|         text = text.replace('_', '-') | ||||
|         L = [] | ||||
|         def morseToLetter(m): | ||||
|             s = m.group(1) | ||||
|             return self._revcode.get(s, s) | ||||
|  | ||||
| @ -69,6 +69,7 @@ class News(callbacks.Privmsg, ChannelDBHandler): | ||||
|                           added_by TEXT | ||||
|                           )""") | ||||
|         db.commit() | ||||
|         return db | ||||
| 
 | ||||
|     def addnews(self, irc, msg, args): | ||||
|         """[<channel>] <expires> <text> | ||||
|  | ||||
| @ -44,16 +44,11 @@ And you'll be able to call the command like this: | ||||
| slashdot | ||||
| 
 | ||||
| Also includes a function for getting info about a specific feed, rssinfo. | ||||
| 
 | ||||
| Commands include: | ||||
|   rsstitles | ||||
|   rssinfo | ||||
| """ | ||||
| 
 | ||||
| from baseplugin import * | ||||
| 
 | ||||
| import time | ||||
| import operator | ||||
| 
 | ||||
| import rssparser | ||||
| 
 | ||||
|  | ||||
| @ -1,8 +1,8 @@ | ||||
| #!/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: | ||||
|         if name[-4:] in ('.pyc', 'pyo'): | ||||
|             os.remove(os.path.join(dirname, name)) | ||||
|  | ||||
| @ -190,9 +190,9 @@ class MiscCommands(callbacks.Privmsg): | ||||
|         Returns the module <command> is in. | ||||
|         """ | ||||
|         command = callbacks.canonicalName(privmsgs.getArgs(args)) | ||||
|         Class = irc.findCallback(command) | ||||
|         if Class is not None: | ||||
|             irc.reply(msg, Class.name()) | ||||
|         cb = irc.findCallback(command) | ||||
|         if cb is not None: | ||||
|             irc.reply(msg, cb.name()) | ||||
|         else: | ||||
|             irc.error(msg, 'There is no such command %s' % command) | ||||
| 
 | ||||
|  | ||||
| @ -45,7 +45,6 @@ import ircdb | ||||
| import world | ||||
| import drivers | ||||
| import ircmsgs | ||||
| import ircutils | ||||
| import schedule | ||||
| 
 | ||||
| class AsyncoreRunnerDriver(drivers.IrcDriver): | ||||
|  | ||||
| @ -178,9 +178,8 @@ def main(): | ||||
|             sys.exit(0) | ||||
| 
 | ||||
| if __name__ == '__main__': | ||||
|     import sys | ||||
|     if '-p' in sys.argv: | ||||
|         import profile, time | ||||
|         import profile | ||||
|         sys.argv.remove('-p') | ||||
|         profile.run('main()', '%i.prof' % time.time()) | ||||
|     if '-O' in sys.argv: | ||||
|  | ||||
| @ -51,7 +51,7 @@ class HtmlToText(sgmllib.SGMLParser): | ||||
|         self.tagReplace = tagReplace | ||||
|         sgmllib.SGMLParser.__init__(self) | ||||
| 
 | ||||
|     def unknown_starttag(self, tag, attrib): | ||||
|     def unknown_starttag(self, tag, attr): | ||||
|         self.data.append(self.tagReplace) | ||||
| 
 | ||||
|     def unknown_endtag(self, tag): | ||||
|  | ||||
| @ -37,7 +37,6 @@ sys.path.insert(0, 'plugins') | ||||
| from fix import * | ||||
| 
 | ||||
| import re | ||||
| import sys | ||||
| import glob | ||||
| import time | ||||
| import os.path | ||||
| @ -141,11 +140,11 @@ class PluginTestCase(unittest.TestCase): | ||||
| 
 | ||||
|     def assertRegexps(self, query, regexps): | ||||
|         started = time.time() | ||||
|         total = len(expectedResponses)*self.timeout | ||||
|         while expectedResponses and time.time() - started < total: | ||||
|         total = len(regexps)*self.timeout | ||||
|         while regexps and time.time() - started < total: | ||||
|             m = self._feedMsg(query) | ||||
|             self.failUnless(m, msg) | ||||
|             regepx = expectedResponses.pop(0) | ||||
|             regexp = regexps.pop(0) | ||||
|             self.failUnless(re.search(regexp, m.args[1]), | ||||
|                             '%r does not match %r' % (m.args[1], regexp)) | ||||
|         self.failIf(time.time() - started > total) | ||||
|  | ||||
| @ -33,8 +33,6 @@ | ||||
| 
 | ||||
| from test import * | ||||
| 
 | ||||
| import pickle | ||||
| 
 | ||||
| class FunctionsTest(unittest.TestCase): | ||||
|     def testCatch(self): | ||||
|         def f(): | ||||
| @ -46,7 +44,7 @@ class FunctionsTest(unittest.TestCase): | ||||
|         revL = list(reviter(L)) | ||||
|         L.reverse() | ||||
|         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') | ||||
| 
 | ||||
|     def testGroup(self): | ||||
|  | ||||
| @ -35,7 +35,6 @@ import os | ||||
| import unittest | ||||
| 
 | ||||
| import conf | ||||
| import debug | ||||
| import ircdb | ||||
| import ircutils | ||||
| 
 | ||||
|  | ||||
| @ -31,7 +31,6 @@ | ||||
| 
 | ||||
| from test import * | ||||
| 
 | ||||
| import copy | ||||
| import pickle | ||||
| 
 | ||||
| import conf | ||||
|  | ||||
| @ -47,7 +47,8 @@ class IrcMsgTestCase(unittest.TestCase): | ||||
|                             strmsg.replace(':', '') == strmsg) | ||||
| 
 | ||||
|     def testRepr(self): | ||||
|         from ircmsgs import IrcMsg | ||||
|         IrcMsg = ircmsgs.IrcMsg | ||||
|         ignore(IrcMsg) # Make pychecker happy. | ||||
|         for msg in msgs: | ||||
|             self.assertEqual(msg, eval(repr(msg))) | ||||
| 
 | ||||
|  | ||||
| @ -138,7 +138,7 @@ class RingBufferTestCase(unittest.TestCase): | ||||
|         self.assertRaises(ValueError, b.__setitem__, slice(0, 10), []) | ||||
|         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[2:4] = L[2:4] | ||||
|         self.assertEquals(b[2:4], L[2:4]) | ||||
|  | ||||
| @ -141,16 +141,16 @@ usesInput = 1 | ||||
| usesExec = 0 | ||||
| 
 | ||||
| # ignore warnings from files under standard library | ||||
| ignoreStandardLibrary = 0 | ||||
| ignoreStandardLibrary = 1 | ||||
| 
 | ||||
| # ignore warnings from the list of modules | ||||
| blacklist = ['Tkinter', 'wxPython', 'gtk', 'GTK', 'GDK', 'asynchat'] | ||||
| 
 | ||||
| # 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 | ||||
| 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 | ||||
| deprecated = 1 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Jeremy Fincher
						Jeremy Fincher