From 8078b4ab7cb7960963551e986348d86160875a57 Mon Sep 17 00:00:00 2001 From: yumoqing Date: Thu, 28 Nov 2019 13:30:11 +0800 Subject: [PATCH] add registerfunction --- appPublic/registerfunction.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 appPublic/registerfunction.py diff --git a/appPublic/registerfunction.py b/appPublic/registerfunction.py new file mode 100644 index 0000000..a69533b --- /dev/null +++ b/appPublic/registerfunction.py @@ -0,0 +1,15 @@ + +from functools import partial +from appPublic.Singleton import SingletonDecorator + +@SingletonDecorator +class RegisterFunction: + def __init__(self): + self.registKW = {} + + def register(self,name,func): + self.registKW[name] = func + + def get(self,name): + return self.registKW.get(name,None) +