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