mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-04 08:59:23 +01:00
Changed not to use the deprecated new module.
This commit is contained in:
parent
08f5adf362
commit
afbf513df2
@ -41,11 +41,11 @@ how to use them.
|
|||||||
import fix
|
import fix
|
||||||
|
|
||||||
import re
|
import re
|
||||||
import new
|
|
||||||
import copy
|
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
|
||||||
@ -657,7 +657,8 @@ class Privmsg(irclib.IrcCallback):
|
|||||||
handleBadArgs()
|
handleBadArgs()
|
||||||
else:
|
else:
|
||||||
handleBadArgs()
|
handleBadArgs()
|
||||||
dispatcher = new.function(dispatcher.func_code,globals(),canonicalname)
|
dispatcher = types.FunctionType(dispatcher.func_code,
|
||||||
|
dispatcher.func_globals, canonicalname)
|
||||||
if self._original:
|
if self._original:
|
||||||
dispatcher.__doc__ = self._original.__doc__
|
dispatcher.__doc__ = self._original.__doc__
|
||||||
else:
|
else:
|
||||||
|
@ -32,10 +32,10 @@
|
|||||||
import fix
|
import fix
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import new
|
|
||||||
import sys
|
import sys
|
||||||
import sets
|
import sets
|
||||||
import time
|
import time
|
||||||
|
import types
|
||||||
import urllib2
|
import urllib2
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
@ -254,9 +254,9 @@ class Toggleable(object):
|
|||||||
code = self.toggle.im_func.func_code
|
code = self.toggle.im_func.func_code
|
||||||
globals = self.toggle.im_func.func_globals
|
globals = self.toggle.im_func.func_globals
|
||||||
closure = self.toggle.im_func.func_closure
|
closure = self.toggle.im_func.func_closure
|
||||||
newf = new.function(code, globals, None, closure=closure)
|
newf = types.FunctionType(code, globals, None, closure=closure)
|
||||||
newf.__doc__ = s
|
newf.__doc__ = s
|
||||||
self.toggle = new.instancemethod(newf, self, self.__class__)
|
self.toggle = types.MethodType(newf, self, self.__class__)
|
||||||
|
|
||||||
def _toggleNames(self):
|
def _toggleNames(self):
|
||||||
names = self.toggles.defaults.keys()
|
names = self.toggles.defaults.keys()
|
||||||
@ -264,6 +264,10 @@ class Toggleable(object):
|
|||||||
return utils.commaAndify(map(repr, names))
|
return utils.commaAndify(map(repr, names))
|
||||||
|
|
||||||
def toggle(self, irc, msg, args):
|
def toggle(self, irc, msg, args):
|
||||||
|
"""[<channel>] <name> [<value>]
|
||||||
|
|
||||||
|
The author of my plugin didn't call Toggleable.__init__.
|
||||||
|
"""
|
||||||
try:
|
try:
|
||||||
channel = privmsgs.getChannel(msg, args)
|
channel = privmsgs.getChannel(msg, args)
|
||||||
capability = ircdb.makeChannelCapability(channel, 'op')
|
capability = ircdb.makeChannelCapability(channel, 'op')
|
||||||
|
@ -35,7 +35,7 @@ Includes various accessories for callbacks.Privmsg based callbacks.
|
|||||||
|
|
||||||
import fix
|
import fix
|
||||||
|
|
||||||
import new
|
import types
|
||||||
|
|
||||||
import conf
|
import conf
|
||||||
import ircdb
|
import ircdb
|
||||||
@ -84,7 +84,7 @@ def checkCapability(f, capability):
|
|||||||
f(self, irc, msg, args)
|
f(self, irc, msg, args)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, conf.replyNoCapability % capability)
|
irc.error(msg, conf.replyNoCapability % capability)
|
||||||
newf = new.function(newf.func_code, newf.func_globals,
|
newf = types.FunctionType(newf.func_code, newf.func_globals,
|
||||||
f.func_name, closure=newf.func_closure)
|
f.func_name, closure=newf.func_closure)
|
||||||
newf.__doc__ = f.__doc__
|
newf.__doc__ = f.__doc__
|
||||||
return newf
|
return newf
|
||||||
@ -99,11 +99,11 @@ def checkChannelCapability(f, capability):
|
|||||||
chancap = ircdb.makeChannelCapability(channel, capability)
|
chancap = ircdb.makeChannelCapability(channel, capability)
|
||||||
if ircdb.checkCapability(msg.prefix, chancap):
|
if ircdb.checkCapability(msg.prefix, chancap):
|
||||||
L += (channel,)
|
L += (channel,)
|
||||||
ff = new.instancemethod(f, self, self.__class__)
|
ff = types.MethodType(f, self, self.__class__)
|
||||||
ff(irc, msg, args, *L)
|
ff(irc, msg, args, *L)
|
||||||
else:
|
else:
|
||||||
irc.error(msg, conf.replyNoCapability % chancap)
|
irc.error(msg, conf.replyNoCapability % chancap)
|
||||||
newf = new.function(newf.func_code, newf.func_globals,
|
newf = types.FunctionType(newf.func_code, newf.func_globals,
|
||||||
f.func_name, closure=newf.func_closure)
|
f.func_name, closure=newf.func_closure)
|
||||||
newf.__doc__ = f.__doc__
|
newf.__doc__ = f.__doc__
|
||||||
return newf
|
return newf
|
||||||
@ -111,10 +111,10 @@ def checkChannelCapability(f, capability):
|
|||||||
def thread(f):
|
def thread(f):
|
||||||
"""Makes sure a command spawns a thread when called."""
|
"""Makes sure a command spawns a thread when called."""
|
||||||
def newf(self, irc, msg, args, *L):
|
def newf(self, irc, msg, args, *L):
|
||||||
ff = new.instancemethod(f, self, self.__class__)
|
ff = types.MethodType(f, self, self.__class__)
|
||||||
t = callbacks.CommandThread(self.callCommand, ff, irc, msg, args, *L)
|
t = callbacks.CommandThread(self.callCommand, ff, irc, msg, args, *L)
|
||||||
t.start()
|
t.start()
|
||||||
newf = new.function(newf.func_code, newf.func_globals,
|
newf = types.FunctionType(newf.func_code, newf.func_globals,
|
||||||
f.func_name, closure=newf.func_closure)
|
f.func_name, closure=newf.func_closure)
|
||||||
newf.__doc__ = f.__doc__
|
newf.__doc__ = f.__doc__
|
||||||
return newf
|
return newf
|
||||||
@ -131,9 +131,9 @@ def name(f):
|
|||||||
else:
|
else:
|
||||||
name = msg.prefix
|
name = msg.prefix
|
||||||
L = (name,) + L
|
L = (name,) + L
|
||||||
ff = new.instancemethod(f, self, self.__class__)
|
ff = types.MethodType(f, self, self.__class__)
|
||||||
ff(irc, msg, args, *L)
|
ff(irc, msg, args, *L)
|
||||||
newf = new.function(newf.func_code, newf.func_globals,
|
newf = types.FunctionType(newf.func_code, newf.func_globals,
|
||||||
f.func_name, closure=newf.func_closure)
|
f.func_name, closure=newf.func_closure)
|
||||||
newf.__doc__ = f.__doc__
|
newf.__doc__ = f.__doc__
|
||||||
return newf
|
return newf
|
||||||
@ -143,9 +143,9 @@ def channel(f):
|
|||||||
def newf(self, irc, msg, args, *L):
|
def newf(self, irc, msg, args, *L):
|
||||||
channel = getChannel(msg, args)
|
channel = getChannel(msg, args)
|
||||||
L = (channel,) + L
|
L = (channel,) + L
|
||||||
ff = new.instancemethod(f, self, self.__class__)
|
ff = types.MethodType(f, self, self.__class__)
|
||||||
ff(irc, msg, args, *L)
|
ff(irc, msg, args, *L)
|
||||||
newf = new.function(newf.func_code, newf.func_globals,
|
newf = types.FunctionType(newf.func_code, newf.func_globals,
|
||||||
f.func_name, closure=newf.func_closure)
|
f.func_name, closure=newf.func_closure)
|
||||||
newf.__doc__ = f.__doc__
|
newf.__doc__ = f.__doc__
|
||||||
return newf
|
return newf
|
||||||
|
Loading…
Reference in New Issue
Block a user