mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Changed some maps/filters to imaps/ifilters for efficiency reasons (I was bored, basically).
This commit is contained in:
parent
eb6e112f70
commit
dc93f865db
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user