fix(key/info): remove redundant None check to satisfy basedpyright delta gate

After if not key: raise, key is narrowed to str. The subsequent
if key is not None: guard is always true and triggers basedpyright
reportUnnecessaryComparison, which fails the delta gate.

Collapse to a single hash_token_if_needed(token=key) call.

Signed-off-by: apex-mochen <2756823972@qq.com>
This commit is contained in:
dingdangmao 2026-11-07 10:20:51 +08:00
parent b3c00afc26
commit 280f14f61f

View file

@ -5111,9 +5111,7 @@ async def info_key_fn(
param="key",
code=status.HTTP_400_BAD_REQUEST,
)
hashed_key: str | None = key
if key is not None:
hashed_key = hash_token_if_needed(token=key) # rebind-ok: pre-existing rebinding on a rename-only line
hashed_key: str | None = hash_token_if_needed(token=key)
live_key_info: Final = await _prisma_table(VerificationTokenRepository(prisma_client)).find_unique(
where={"token": hashed_key},
include={"litellm_budget_table": True},