This commit is contained in:
yumoqing 2024-07-17 19:11:03 +08:00
parent 31a72f54ac
commit 54393c736e

View File

@ -1,4 +1,4 @@
from inspect import isfunction, isroutinefunction
from functools import partial from functools import partial
from appPublic.Singleton import SingletonDecorator from appPublic.Singleton import SingletonDecorator
@ -8,6 +8,9 @@ class RegisterFunction:
self.registKW = {} self.registKW = {}
def register(self,name,func): def register(self,name,func):
if not isfunction(func) and not isroutinefunction(func):
error(f'RegisterFunction.register({name}, {func}): func is not a function or routine')
return
self.registKW[name] = func self.registKW[name] = func
def get(self,name): def get(self,name):