Change canonize => normalize

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
This commit is contained in:
James Vega 2009-08-27 16:41:34 -04:00
parent e922918564
commit eff20402ac
3 changed files with 5 additions and 5 deletions

View File

@ -82,7 +82,7 @@ def registerRename(plugin, command=None, newName=None):
def renameCommand(cb, name, newName):
assert not hasattr(cb, newName), 'Cannot rename over existing attributes.'
assert newName == callbacks.canonicalName(newName), \
'newName must already be canonized.'
'newName must already be normalized.'
if name != newName:
method = getattr(cb.__class__, name)
setattr(cb.__class__, newName, method)

View File

@ -174,11 +174,11 @@ class RSS(callbacks.Plugin):
'Unable to download feed.'):
self.log.debug('%s %u', s, url)
return
def canonize(headline):
def normalize(headline):
return (tuple(headline[0].lower().split()), headline[1])
oldheadlines = set(map(canonize, oldheadlines))
oldheadlines = set(map(normalize, oldheadlines))
for (i, headline) in enumerate(newheadlines):
if canonize(headline) in oldheadlines:
if normalize(headline) in oldheadlines:
newheadlines[i] = None
newheadlines = filter(None, newheadlines) # Removes Nones.
if newheadlines:

View File

@ -1078,7 +1078,7 @@ class Commands(BasePlugin):
# This function is ugly, but I don't want users to call methods like
# doPrivmsg or __init__ or whatever, and this is good to stop them.
# Don't canonize this name: consider outFilter(self, irc, msg).
# Don't normalize this name: consider outFilter(self, irc, msg).
# name = canonicalName(name)
if self.isDisabled(name):
return False