mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-27 13:19:24 +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 getopt
|
||||||
import string
|
import string
|
||||||
import os.path
|
import os.path
|
||||||
|
from itertools import imap
|
||||||
|
|
||||||
import sqlite
|
import sqlite
|
||||||
|
|
||||||
@ -102,7 +103,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||||||
cursor.execute("""INSERT INTO keys VALUES (NULL, %s, 0)""", key)
|
cursor.execute("""INSERT INTO keys VALUES (NULL, %s, 0)""", key)
|
||||||
db.commit()
|
db.commit()
|
||||||
cursor.execute("SELECT id, locked FROM keys WHERE key LIKE %s",key)
|
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')
|
capability = ircdb.makeChannelCapability(channel, 'factoids')
|
||||||
if not locked:
|
if not locked:
|
||||||
if not ircdb.checkCapability(msg.prefix, capability):
|
if not ircdb.checkCapability(msg.prefix, capability):
|
||||||
@ -296,7 +297,7 @@ class Factoids(plugins.ChannelDBHandler, callbacks.Privmsg):
|
|||||||
if cursor.rowcount == 0:
|
if cursor.rowcount == 0:
|
||||||
irc.error(msg, 'No factoid matches that key.')
|
irc.error(msg, 'No factoid matches that key.')
|
||||||
return
|
return
|
||||||
(id, locked) = map(int, cursor.fetchone())
|
(id, locked) = imap(int, cursor.fetchone())
|
||||||
cursor.execute("""SELECT added_by, added_at FROM factoids
|
cursor.execute("""SELECT added_by, added_at FROM factoids
|
||||||
WHERE key_id=%s
|
WHERE key_id=%s
|
||||||
ORDER BY id""", id)
|
ORDER BY id""", id)
|
||||||
|
@ -38,6 +38,7 @@ import plugins
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
import os.path
|
import os.path
|
||||||
|
from itertools import imap
|
||||||
|
|
||||||
import sqlite
|
import sqlite
|
||||||
|
|
||||||
@ -167,7 +168,7 @@ class Note(callbacks.Privmsg):
|
|||||||
irc.error(msg, s)
|
irc.error(msg, s)
|
||||||
return
|
return
|
||||||
(note, toId, fromId, addedAt, public) = cursor.fetchone()
|
(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)
|
elapsed = utils.timeElapsed(time.time() - addedAt)
|
||||||
if toId == id:
|
if toId == id:
|
||||||
author = ircdb.users.getUser(fromId).name
|
author = ircdb.users.getUser(fromId).name
|
||||||
@ -179,7 +180,7 @@ class Note(callbacks.Privmsg):
|
|||||||
self.setAsRead(noteid)
|
self.setAsRead(noteid)
|
||||||
|
|
||||||
def _formatNoteData(self, msg, id, fromId, public):
|
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]):
|
if public or not ircutils.isChannel(msg.args[0]):
|
||||||
sender = ircdb.users.getUser(fromId).name
|
sender = ircdb.users.getUser(fromId).name
|
||||||
return '#%s from %s' % (id, sender)
|
return '#%s from %s' % (id, sender)
|
||||||
|
@ -37,6 +37,7 @@ module for user-friendliness.
|
|||||||
import plugins
|
import plugins
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
from itertools import imap
|
||||||
|
|
||||||
import rssparser
|
import rssparser
|
||||||
|
|
||||||
@ -84,10 +85,10 @@ class RSS(callbacks.Privmsg):
|
|||||||
feed = self.cachedFeeds[url]
|
feed = self.cachedFeeds[url]
|
||||||
headlines = [d['title'].strip().replace('\n', ' ') \
|
headlines = [d['title'].strip().replace('\n', ' ') \
|
||||||
for d in feed['items']]
|
for d in feed['items']]
|
||||||
headlines = map(utils.htmlToText, headlines)
|
|
||||||
if not headlines:
|
if not headlines:
|
||||||
irc.error(msg, 'Error grabbing RSS feed')
|
irc.error(msg, 'Error grabbing RSS feed')
|
||||||
return
|
return
|
||||||
|
headlines = imap(utils.htmlToText, headlines)
|
||||||
irc.reply(msg, ' :: '.join(headlines))
|
irc.reply(msg, ' :: '.join(headlines))
|
||||||
|
|
||||||
def info(self, irc, msg, args):
|
def info(self, irc, msg, args):
|
||||||
|
@ -35,6 +35,7 @@ import os
|
|||||||
import sets
|
import sets
|
||||||
import time
|
import time
|
||||||
import string
|
import string
|
||||||
|
from itertools import imap
|
||||||
|
|
||||||
import conf
|
import conf
|
||||||
import debug
|
import debug
|
||||||
@ -145,7 +146,7 @@ class CapabilitySet(sets.Set):
|
|||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return '%s([%s])' % (self.__class__.__name__,
|
return '%s([%s])' % (self.__class__.__name__,
|
||||||
', '.join(map(repr, self)))
|
', '.join(imap(repr, self)))
|
||||||
|
|
||||||
antiOwner = makeAntiCapability('owner')
|
antiOwner = makeAntiCapability('owner')
|
||||||
class UserCapabilitySet(CapabilitySet):
|
class UserCapabilitySet(CapabilitySet):
|
||||||
|
Loading…
Reference in New Issue
Block a user