I have an object whose primary value is in applying a given decorator to every function it inherits from its super class and providing a separate version of it. For reference the decorator is below:
def hierarchywrapper(func):
def wrapper(self, *args, **kwargs):
for key, value in self.hierarchy.items():
try:
result = getattr(value, func.__name__)(*args, **kwargs)
if result and len(result):
return result
else:
pass
except:
pass
return None
return wrapper
The super class of the object containing this decorator has quite a few functions and I would prefer not to have to write out stubs for every one of them. As you can tell, the contents of these functions aren't very important and just need stubs really.
Is there some way to define function stubs en masse? Alternately is there some way I could indicate that I just want to apply this decorator to every inherited function?