mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 19:19:32 +01:00
Updated the rest of the code to use utils.changeFunctionName.
This commit is contained in:
parent
8a322cfddf
commit
b2f23c6f63
@ -40,7 +40,6 @@ import plugins
|
|||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sets
|
import sets
|
||||||
import types
|
|
||||||
|
|
||||||
import conf
|
import conf
|
||||||
import utils
|
import utils
|
||||||
@ -148,10 +147,9 @@ def makeNewAlias(name, alias):
|
|||||||
Owner = irc.getCallback('Owner')
|
Owner = irc.getCallback('Owner')
|
||||||
Owner.disambiguate(irc, tokens)
|
Owner.disambiguate(irc, tokens)
|
||||||
self.Proxy(irc.irc, msg, tokens)
|
self.Proxy(irc.irc, msg, tokens)
|
||||||
f = types.FunctionType(f.func_code, f.func_globals,
|
doc ='<an alias, %s>\n\nAlias for %r' % \
|
||||||
name, closure=f.func_closure)
|
(utils.nItems('argument', biggestDollar), alias)
|
||||||
f.__doc__ ='<an alias, %s>\n\nAlias for %r' % \
|
f = utils.changeFunctionName(f, name, doc)
|
||||||
(utils.nItems('argument', biggestDollar), alias)
|
|
||||||
return f
|
return f
|
||||||
|
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ import os
|
|||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import sets
|
import sets
|
||||||
import types
|
|
||||||
import getopt
|
import getopt
|
||||||
import string
|
import string
|
||||||
|
|
||||||
@ -183,8 +182,6 @@ class Lookup(callbacks.Privmsg):
|
|||||||
def f(self, irc, msg, args):
|
def f(self, irc, msg, args):
|
||||||
args.insert(0, name)
|
args.insert(0, name)
|
||||||
self._lookup(irc, msg, args)
|
self._lookup(irc, msg, args)
|
||||||
f = types.FunctionType(f.func_code, f.func_globals,
|
|
||||||
name, closure=f.func_closure)
|
|
||||||
db = self.dbHandler.getDb()
|
db = self.dbHandler.getDb()
|
||||||
cursor = db.cursor()
|
cursor = db.cursor()
|
||||||
cursor.execute("""SELECT COUNT(*) FROM %s""" % name)
|
cursor.execute("""SELECT COUNT(*) FROM %s""" % name)
|
||||||
@ -195,9 +192,7 @@ class Lookup(callbacks.Privmsg):
|
|||||||
returns a random key: value pair from the database. There are
|
returns a random key: value pair from the database. There are
|
||||||
%s in the database.
|
%s in the database.
|
||||||
""" % (name, utils.nItems(name, rows))
|
""" % (name, utils.nItems(name, rows))
|
||||||
f = types.FunctionType(f.func_code, f.func_globals,
|
f = utils.changeFunctionName(f, name, docstring)
|
||||||
f.func_name, closure=f.func_closure)
|
|
||||||
f.__doc__ = docstring
|
|
||||||
self.lookupDomains.add(name)
|
self.lookupDomains.add(name)
|
||||||
setattr(self.__class__, name, f)
|
setattr(self.__class__, name, f)
|
||||||
|
|
||||||
|
@ -40,7 +40,6 @@ import plugins
|
|||||||
|
|
||||||
import sets
|
import sets
|
||||||
import time
|
import time
|
||||||
import types
|
|
||||||
from itertools import imap
|
from itertools import imap
|
||||||
|
|
||||||
import rssparser
|
import rssparser
|
||||||
@ -170,9 +169,7 @@ class RSS(callbacks.Privmsg, configurable.Mixin):
|
|||||||
def f(self, irc, msg, args):
|
def f(self, irc, msg, args):
|
||||||
args.insert(0, url)
|
args.insert(0, url)
|
||||||
self.rss(irc, msg, args)
|
self.rss(irc, msg, args)
|
||||||
f = types.FunctionType(f.func_code, f.func_globals,
|
f = utils.changeFunctionName(f, name, docstring)
|
||||||
name, closure=f.func_closure)
|
|
||||||
f.__doc__ = docstring
|
|
||||||
f.url = url # Used by __call__.
|
f.url = url # Used by __call__.
|
||||||
self.feedNames.add(name)
|
self.feedNames.add(name)
|
||||||
setattr(self.__class__, name, f)
|
setattr(self.__class__, name, f)
|
||||||
|
@ -47,7 +47,6 @@ import copy
|
|||||||
import sets
|
import sets
|
||||||
import time
|
import time
|
||||||
import shlex
|
import shlex
|
||||||
import types
|
|
||||||
import getopt
|
import getopt
|
||||||
import string
|
import string
|
||||||
import inspect
|
import inspect
|
||||||
@ -649,8 +648,7 @@ class Privmsg(irclib.IrcCallback):
|
|||||||
handleBadArgs()
|
handleBadArgs()
|
||||||
else:
|
else:
|
||||||
handleBadArgs()
|
handleBadArgs()
|
||||||
dispatcher = types.FunctionType(dispatcher.func_code,
|
dispatcher = utils.changeFunctionName(dispatcher, canonicalname)
|
||||||
dispatcher.func_globals, canonicalname)
|
|
||||||
if self._original:
|
if self._original:
|
||||||
dispatcher.__doc__ = self._original.__doc__
|
dispatcher.__doc__ = self._original.__doc__
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user