def _handlerfunc functoolswrapsfunc def wrapargs kwargs timesleepsettingexecute_interval msg = start to test formatgetattrfunc CASE_INFO_FLAG
这个方法需要被装饰器调用才能执行。可以将该方法作为装饰器,在需要执行的函数上加上@_handler的装饰器注解,这样在执行该函数时,就会先执行_handler方法中的逻辑。例如:
@_handler def my_function(): # do something pass
在调用my_function时,会先执行_handler方法中的逻辑,然后再执行my_function中的逻辑。
原文地址: https://www.cveoy.top/t/topic/bFNg 著作权归作者所有。请勿转载和采集!