应用于所有方法的类修饰符
decorate-all-methods的Python项目详细描述
装饰所有方法
对类的所有方法应用decorator的decorator。
安装
pip install decorate-all-methods
示例用法
fromdecorate_all_methodsimportdecorate_all_methodsfromtenacityimportretry,stop_after_attempt,wait_fixed@decorate_all_methods(retry(stop=stop_after_attempt(3),wait=wait_fixed(1)),exclude=['__init__'])classMyClass(object):def__init__(self,object):"""Will not be retried."""passdefforce_error(self):"""Will be retried 3 times."""assertFalsedefforce_another_error(self):"""Will also be retried 3 times."""assertFalse
注意:不必排除任何方法。
版本控制
我们使用SemVer进行版本控制。
许可证
此项目是在apache许可2.0版下授权的。