Stupid asserts. Definitely not worth it there.

This commit is contained in:
Jeremy Fincher 2004-09-10 06:58:36 +00:00
parent d3421b0bd0
commit 8eeab87a98

View File

@ -933,7 +933,7 @@ class Privmsg(irclib.IrcCallback):
# attributes which are lists of plugin names which the plugin should be # attributes which are lists of plugin names which the plugin should be
# called before and after, respectively. We may, at some future point, # called before and after, respectively. We may, at some future point,
# remove priority entirely. # remove priority entirely.
def __cmp__(self, other, doAssert=True): def __cmp__(self, other):
selfName = self.name() selfName = self.name()
otherName = other.name() otherName = other.name()
# We can't be certain of the order the callbacks list is in, so we # 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. # we basically run the other callback's as well.
if isinstance(other, Privmsg): if isinstance(other, Privmsg):
if otherName in self.callAfter or selfName in other.callBefore: if otherName in self.callAfter or selfName in other.callBefore:
ret = 1 return 1
elif otherName in self.callBefore or selfName in other.callAfter: elif otherName in self.callBefore or selfName in other.callAfter:
ret = -1 return -1
else: return self.__parent.__cmp__(other)
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
def __call__(self, irc, msg): def __call__(self, irc, msg):
if msg.command == 'PRIVMSG': if msg.command == 'PRIVMSG':