mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 19:22:45 +01:00
Stupid asserts. Definitely not worth it there.
This commit is contained in:
parent
d3421b0bd0
commit
8eeab87a98
@ -933,7 +933,7 @@ class Privmsg(irclib.IrcCallback):
|
||||
# attributes which are lists of plugin names which the plugin should be
|
||||
# called before and after, respectively. We may, at some future point,
|
||||
# remove priority entirely.
|
||||
def __cmp__(self, other, doAssert=True):
|
||||
def __cmp__(self, other):
|
||||
selfName = self.name()
|
||||
otherName = other.name()
|
||||
# We can't be certain of the order the callbacks list is in, so we
|
||||
@ -941,24 +941,10 @@ class Privmsg(irclib.IrcCallback):
|
||||
# we basically run the other callback's as well.
|
||||
if isinstance(other, Privmsg):
|
||||
if otherName in self.callAfter or selfName in other.callBefore:
|
||||
ret = 1
|
||||
return 1
|
||||
elif otherName in self.callBefore or selfName in other.callAfter:
|
||||
ret = -1
|
||||
else:
|
||||
ret = self.__parent.__cmp__(other)
|
||||
else:
|
||||
ret = self.__parent.__cmp__(other)
|
||||
if doAssert:
|
||||
try:
|
||||
otherRet = other.__cmp__(self, doAssert=False)
|
||||
except TypeError, e:
|
||||
if 'doAssert' in str(e): # unexpected keyword argument.
|
||||
otherRet = cmp(other, self)
|
||||
else:
|
||||
otherRet = ret
|
||||
assert ret+otherRet==0, 'callbacks\' __cmp__ disagree: %s, %s' % \
|
||||
(selfName, otherName)
|
||||
return ret
|
||||
return -1
|
||||
return self.__parent.__cmp__(other)
|
||||
|
||||
def __call__(self, irc, msg):
|
||||
if msg.command == 'PRIVMSG':
|
||||
|
Loading…
Reference in New Issue
Block a user