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) 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 Class = Admin

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -774,7 +774,7 @@ class UsersDictionary(utils.IterableMap):
self.nextId = max(self.nextId, user.id) self.nextId = max(self.nextId, user.id)
try: try:
if self.getUserId(user.name) != user.id: if self.getUserId(user.name) != user.id:
raise DuplicateHostmask(hostmask) raise DuplicateHostmask(user.name)
except KeyError: except KeyError:
pass pass
for hostmask in user.hostmasks: 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 if isinstance(channels, str): # Backward compatibility
channels = [channels] channels = [channels]
if conf.supybot.protocols.irc.strictRfc(): if conf.supybot.protocols.irc.strictRfc():
assert areChannels(channels), repr(channel) assert areChannels(channels), repr(channels)
assert areNicks(nicks), repr(nicks) assert areNicks(nicks), repr(nicks)
if msg and not prefix: if msg and not prefix:
prefix = msg.prefix prefix = msg.prefix
@ -561,9 +561,11 @@ def kicks(channels, nicks, s='', prefix='', msg=None):
s = s.encode('utf8') s = s.encode('utf8')
assert isinstance(s, str) assert isinstance(s, str)
if s: if s:
for channel in channels:
return IrcMsg(prefix=prefix, command='KICK', return IrcMsg(prefix=prefix, command='KICK',
args=(channel, ','.join(nicks), s), msg=msg) args=(channel, ','.join(nicks), s), msg=msg)
else: else:
for channel in channels:
return IrcMsg(prefix=prefix, command='KICK', return IrcMsg(prefix=prefix, command='KICK',
args=(channel, ','.join(nicks)), msg=msg) args=(channel, ','.join(nicks)), msg=msg)

View File

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

View File

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

View File

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