]> jfr.im git - erebus.git/commitdiff
use functools.wraps instead of rolling our own
authorzonidjan <redacted>
Mon, 8 Mar 2021 22:34:13 +0000 (16:34 -0600)
committerzonidjan <redacted>
Mon, 8 Mar 2021 22:34:13 +0000 (16:34 -0600)
modlib.py

index e711086a281b42fe90bc408873d982863b4242f3..721fa2d9b375d8a96a92d9bb17ace6d866096d66 100644 (file)
--- a/modlib.py
+++ b/modlib.py
@@ -4,6 +4,7 @@
 # This file is released into the public domain; see http://unlicense.org/
 
 import sys
+from functools import wraps
 
 if sys.version_info.major < 3:
        stringbase = basestring
@@ -143,25 +144,23 @@ class modlib(object):
 
        def argsEQ(self, num):
                def realhook(func):
+                       @wraps(func)
                        def checkargs(bot, user, chan, realtarget, *args):
                                if len(args) == num:
                                        return func(bot, user, chan, realtarget, *args)
                                else:
                                        bot.msg(user, self.WRONGARGS)
-                       checkargs.__name__ = func.__name__
-                       checkargs.__module__ = func.__module__
                        return checkargs
                return realhook
 
        def argsGE(self, num):
                def realhook(func):
+                       @wraps(func)
                        def checkargs(bot, user, chan, realtarget, *args):
                                if len(args) >= num:
                                        return func(bot, user, chan, realtarget, *args)
                                else:
                                        bot.msg(user, self.WRONGARGS)
-                       checkargs.__name__ = func.__name__
-                       checkargs.__module__ = func.__module__
                        return checkargs
                return realhook