Changed some maps/filters to imaps/ifilters for efficiency reasons (I was bored, basically).

This commit is contained in:
Jeremy Fincher 2003-11-15 04:46:09 +00:00
parent eb6e112f70
commit dc93f865db
4 changed files with 10 additions and 6 deletions

View File

@ -40,6 +40,7 @@ import time
import getopt
import string
import os.path
from itertools import imap
import sqlite
@ -102,7 +103,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
cursor.execute("""INSERT INTO keys VALUES (NULL, %s, 0)""", key)
db.commit()
cursor.execute("SELECT id, locked FROM keys WHERE key LIKE %s",key)
(id, locked) = map(int, cursor.fetchone())
(id, locked) = imap(int, cursor.fetchone())
capability = ircdb.makeChannelCapability(channel, 'factoids')
if not locked:
if not ircdb.checkCapability(msg.prefix, capability):
@ -296,7 +297,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
if cursor.rowcount == 0:
irc.error(msg, 'No factoid matches that key.')
return
(id, locked) = map(int, cursor.fetchone())
(id, locked) = imap(int, cursor.fetchone())
cursor.execute("""SELECT added_by, added_at FROM factoids
WHERE key_id=%s
ORDER BY id""", id)

View File

@ -38,6 +38,7 @@ import plugins
import time
import os.path
from itertools import imap
import sqlite
@ -167,7 +168,7 @@ class Note(callbacks.Privmsg):
irc.error(msg, s)
return
(note, toId, fromId, addedAt, public) = cursor.fetchone()
(toId,fromId,addedAt,public) = map(int, (toId,fromId,addedAt,public))
(toId,fromId,addedAt,public) = imap(int, (toId,fromId,addedAt,public))
elapsed = utils.timeElapsed(time.time() - addedAt)
if toId == id:
author = ircdb.users.getUser(fromId).name
@ -179,7 +180,7 @@ class Note(callbacks.Privmsg):
self.setAsRead(noteid)
def _formatNoteData(self, msg, id, fromId, public):
(id, fromId, public) = map(int, (id, fromId, public))
(id, fromId, public) = imap(int, (id, fromId, public))
if public or not ircutils.isChannel(msg.args[0]):
sender = ircdb.users.getUser(fromId).name
return '#%s from %s' % (id, sender)

View File

@ -37,6 +37,7 @@ module for user-friendliness.
import plugins
import time
from itertools import imap
import rssparser
@ -84,10 +85,10 @@ class RSS(callbacks.Privmsg):
feed = self.cachedFeeds[url]
headlines = [d['title'].strip().replace('\n', ' ') \
for d in feed['items']]
headlines = map(utils.htmlToText, headlines)
if not headlines:
irc.error(msg, 'Error grabbing RSS feed')
return
headlines = imap(utils.htmlToText, headlines)
irc.reply(msg, ' :: '.join(headlines))
def info(self, irc, msg, args):

View File

@ -35,6 +35,7 @@ import os
import sets
import time
import string
from itertools import imap
import conf
import debug
@ -145,7 +146,7 @@ class CapabilitySet(sets.Set):
def __repr__(self):
return '%s([%s])' % (self.__class__.__name__,
', '.join(map(repr, self)))
', '.join(imap(repr, self)))
antiOwner = makeAntiCapability('owner')
class UserCapabilitySet(CapabilitySet):