mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-03 16:39:25 +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 re
|
||||
import new
|
||||
import copy
|
||||
import sets
|
||||
import time
|
||||
import shlex
|
||||
import types
|
||||
import getopt
|
||||
import string
|
||||
import inspect
|
||||
@ -657,7 +657,8 @@ class Privmsg(irclib.IrcCallback):
|
||||
handleBadArgs()
|
||||
else:
|
||||
handleBadArgs()
|
||||
dispatcher = new.function(dispatcher.func_code,globals(),canonicalname)
|
||||
dispatcher = types.FunctionType(dispatcher.func_code,
|
||||
dispatcher.func_globals, canonicalname)
|
||||
if self._original:
|
||||
dispatcher.__doc__ = self._original.__doc__
|
||||
else:
|
||||
|
@ -32,10 +32,10 @@
|
||||
import fix
|
||||
|
||||
import os
|
||||
import new
|
||||
import sys
|
||||
import sets
|
||||
import time
|
||||
import types
|
||||
import urllib2
|
||||
import threading
|
||||
|
||||
@ -254,9 +254,9 @@ class Toggleable(object):
|
||||
code = self.toggle.im_func.func_code
|
||||
globals = self.toggle.im_func.func_globals
|
||||
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
|
||||
self.toggle = new.instancemethod(newf, self, self.__class__)
|
||||
self.toggle = types.MethodType(newf, self, self.__class__)
|
||||
|
||||
def _toggleNames(self):
|
||||
names = self.toggles.defaults.keys()
|
||||
@ -264,6 +264,10 @@ class Toggleable(object):
|
||||
return utils.commaAndify(map(repr, names))
|
||||
|
||||
def toggle(self, irc, msg, args):
|
||||
"""[<channel>] <name> [<value>]
|
||||
|
||||
The author of my plugin didn't call Toggleable.__init__.
|
||||
"""
|
||||
try:
|
||||
channel = privmsgs.getChannel(msg, args)
|
||||
capability = ircdb.makeChannelCapability(channel, 'op')
|
||||
|
@ -35,7 +35,7 @@ Includes various accessories for callbacks.Privmsg based callbacks.
|
||||
|
||||
import fix
|
||||
|
||||
import new
|
||||
import types
|
||||
|
||||
import conf
|
||||
import ircdb
|
||||
@ -84,7 +84,7 @@ def checkCapability(f, capability):
|
||||
f(self, irc, msg, args)
|
||||
else:
|
||||
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)
|
||||
newf.__doc__ = f.__doc__
|
||||
return newf
|
||||
@ -99,11 +99,11 @@ def checkChannelCapability(f, capability):
|
||||
chancap = ircdb.makeChannelCapability(channel, capability)
|
||||
if ircdb.checkCapability(msg.prefix, chancap):
|
||||
L += (channel,)
|
||||
ff = new.instancemethod(f, self, self.__class__)
|
||||
ff = types.MethodType(f, self, self.__class__)
|
||||
ff(irc, msg, args, *L)
|
||||
else:
|
||||
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)
|
||||
newf.__doc__ = f.__doc__
|
||||
return newf
|
||||
@ -111,10 +111,10 @@ def checkChannelCapability(f, capability):
|
||||
def thread(f):
|
||||
"""Makes sure a command spawns a thread when called."""
|
||||
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.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)
|
||||
newf.__doc__ = f.__doc__
|
||||
return newf
|
||||
@ -131,9 +131,9 @@ def name(f):
|
||||
else:
|
||||
name = msg.prefix
|
||||
L = (name,) + L
|
||||
ff = new.instancemethod(f, self, self.__class__)
|
||||
ff = types.MethodType(f, self, self.__class__)
|
||||
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)
|
||||
newf.__doc__ = f.__doc__
|
||||
return newf
|
||||
@ -143,9 +143,9 @@ def channel(f):
|
||||
def newf(self, irc, msg, args, *L):
|
||||
channel = getChannel(msg, args)
|
||||
L = (channel,) + L
|
||||
ff = new.instancemethod(f, self, self.__class__)
|
||||
ff = types.MethodType(f, self, self.__class__)
|
||||
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)
|
||||
newf.__doc__ = f.__doc__
|
||||
return newf
|
||||
|
Loading…
Reference in New Issue
Block a user