fix: 修复 pre-commit hook 基于pyright 配置
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from collections.abc import Mapping
|
||||
from dataclasses import dataclass
|
||||
from uuid import UUID
|
||||
|
||||
from models.profile import Profile
|
||||
|
||||
|
||||
@dataclass
|
||||
class ContactInfo:
|
||||
@@ -13,7 +16,7 @@ class ContactInfo:
|
||||
async def resolve_contacts_by_user_ids(
|
||||
*,
|
||||
user_ids: list[UUID],
|
||||
profiles_by_id: dict[UUID, object],
|
||||
profiles_by_id: Mapping[UUID, Profile],
|
||||
auth_gateway: object,
|
||||
) -> dict[UUID, ContactInfo]:
|
||||
_ = auth_gateway
|
||||
|
||||
Reference in New Issue
Block a user