qa: 增加显式 return 语句

This commit is contained in:
春河晴
2025-06-10 15:42:48 +09:00
parent eacdbb8d31
commit 1534e99094
5 changed files with 8 additions and 3 deletions

View File

@@ -111,11 +111,13 @@ class Timer:
async def async_wrapper(*args, **kwargs):
with self:
return await func(*args, **kwargs)
return None
@wraps(func)
def sync_wrapper(*args, **kwargs):
with self:
return func(*args, **kwargs)
return None
wrapper = async_wrapper if asyncio.iscoroutinefunction(func) else sync_wrapper
wrapper.__timer__ = self # 保留计时器引用