Fix errors detected by PyLint.

This commit is contained in:
Valentin Lorentz 2014-03-05 14:14:36 +01:00
parent 8a5c4753d0
commit 77e6de6bba
12 changed files with 18 additions and 24 deletions

View File

@ -366,16 +366,6 @@ class Admin(callbacks.Plugin):
clearq = wrap(clearq)
@internationalizeDocstring
def clearq(self, irc, msg, args):
"""takes no arguments
Clears the current send queue for this network.
"""
irc.queue.reset()
irc.replySuccess()
Class = Admin

View File

@ -408,7 +408,6 @@ class Channel(callbacks.Plugin):
self.log.warning('%q attempted kban without %s',
msg.prefix, capability)
irc.errorNoCapability(capability)
exact,nick,user,host
@internationalizeDocstring
def unban(self, irc, msg, args, channel, hostmask):

View File

@ -51,7 +51,7 @@ _ = PluginInternationalization('Config')
def getWrapper(name):
parts = registry.split(name)
if not parts or parts[0] not in ('supybot', 'users'):
raise InvalidRegistryName(name)
raise registry.InvalidRegistryName(name)
group = getattr(conf, parts.pop(0))
while parts:
try:

View File

@ -222,7 +222,7 @@ class Relay(callbacks.Plugin):
if ops:
L.append(format(_('is an op on %L'), ops))
if halfops:
L.append(format(_('is a halfop on %L'), halfups))
L.append(format(_('is a halfop on %L'), halfops))
if voices:
L.append(format(_('is voiced on %L'), voices))
if normal:

View File

@ -301,7 +301,7 @@ class ShrinkUrl(callbacks.PluginRegexp):
self.db.set('ur1', url, ur1ca)
return ur1ca
else:
raise ShrinkError(text)
raise ShrinkError(response)
def ur1(self, irc, msg, args, url):
"""<url>

View File

@ -354,11 +354,11 @@ class User(callbacks.Plugin):
irc.error(str(e), Raise=True)
try:
ircdb.users.setUser(user)
except ValueError as e:
irc.error(str(e), Raise=True)
except ircdb.DuplicateHostmask:
irc.error(_('That hostmask is already registered.'),
Raise=True)
except ValueError as e:
irc.error(str(e), Raise=True)
irc.replySuccess()
add = wrap(add, ['private', first('otherUser', 'user'),
optional('something'), additional('something', '')])

View File

@ -150,7 +150,7 @@ class Debug(callbacks.Privmsg):
given, sys.stdout is used. This causes much output.
"""
if filename:
fd = file(filename, 'a')
fd = open(filename, 'a')
else:
fd = sys.stdout
sys.settrace(getTracer(fd))

View File

@ -774,7 +774,7 @@ class UsersDictionary(utils.IterableMap):
self.nextId = max(self.nextId, user.id)
try:
if self.getUserId(user.name) != user.id:
raise DuplicateHostmask(hostmask)
raise DuplicateHostmask(user.name)
except KeyError:
pass
for hostmask in user.hostmasks:

View File

@ -553,7 +553,7 @@ def kicks(channels, nicks, s='', prefix='', msg=None):
if isinstance(channels, str): # Backward compatibility
channels = [channels]
if conf.supybot.protocols.irc.strictRfc():
assert areChannels(channels), repr(channel)
assert areChannels(channels), repr(channels)
assert areNicks(nicks), repr(nicks)
if msg and not prefix:
prefix = msg.prefix
@ -561,11 +561,13 @@ def kicks(channels, nicks, s='', prefix='', msg=None):
s = s.encode('utf8')
assert isinstance(s, str)
if s:
return IrcMsg(prefix=prefix, command='KICK',
args=(channel, ','.join(nicks), s), msg=msg)
for channel in channels:
return IrcMsg(prefix=prefix, command='KICK',
args=(channel, ','.join(nicks), s), msg=msg)
else:
return IrcMsg(prefix=prefix, command='KICK',
args=(channel, ','.join(nicks)), msg=msg)
for channel in channels:
return IrcMsg(prefix=prefix, command='KICK',
args=(channel, ','.join(nicks)), msg=msg)
def privmsg(recipient, s, prefix='', msg=None):
"""Returns a PRIVMSG to recipient with the message msg."""

View File

@ -35,6 +35,7 @@ Simple utility functions related to strings.
import re
import sys
import time
import string
import textwrap

View File

@ -53,6 +53,8 @@ class InProgress(error.Error):
error.Error.__init__(self, msg, e)
class InvalidCwd(Exception):
pass
class TransactionMixin(python.Object):
JOURNAL = 'journal'
ORIGINALS = 'originals'

View File

@ -55,7 +55,7 @@ def isMainThread():
threadsSpawned = 1 # Starts at one for the initial "thread."
class SupyThread(threading.Thread):
class SupyThread(threading.Thread, object):
def __init__(self, *args, **kwargs):
global threadsSpawned
threadsSpawned += 1