fix: 修复 pre-commit hook 基于pyright 配置

This commit is contained in:
qzl
2026-04-08 18:00:08 +08:00
parent 8cf0011720
commit 17a1303f00
7 changed files with 19 additions and 12 deletions
+3 -1
View File
@@ -61,7 +61,9 @@ async def _enforce_rate_limit_with_redis(
window_seconds: int,
) -> None:
client = await get_or_init_redis_client()
current = await client.eval(_REDIS_LIMIT_SCRIPT, 1, key, window_seconds) # type: ignore[await]
# redis-py type stub bug: eval() declares Union[Awaitable[str], str]
# but actually always returns awaitable in async context
current = await client.eval(_REDIS_LIMIT_SCRIPT, 1, key, window_seconds) # pyright: ignore[reportGeneralTypeIssues]
if int(current) > limit:
raise ApiProblemError(
status_code=429,