refactor: enforce BasedPyright strict type checking (#5158)
This commit is contained in:
1 parent
e703481755
commit
757ad9c764
166 files changed
+4728
-2621
No files matched your search
@@ -13,7 +13,7 @@ import mimetypes
|
||||
import os
|
||||
from collections.abc import Callable
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from typing import Any, cast
|
||||
|
||||
import httpx
|
||||
from loguru import logger
|
||||
@@ -116,7 +116,7 @@ async def _request_json_with_retry(
|
||||
url: str,
|
||||
*,
|
||||
provider_label: str,
|
||||
**kwargs: object,
|
||||
**kwargs: Any,
|
||||
) -> dict[str, Any] | None:
|
||||
for attempt in range(_MAX_RETRIES + 1):
|
||||
try:
|
||||
@@ -190,7 +190,7 @@ async def _request_json_with_retry(
|
||||
type(payload).__name__,
|
||||
)
|
||||
return None
|
||||
return payload
|
||||
return cast(dict[str, Any], payload)
|
||||
return None
|
||||
|
||||
|
||||
@@ -383,6 +383,7 @@ async def _post_stepfun_asr_with_retry(
|
||||
payload = json.loads(payload_str)
|
||||
except (json.JSONDecodeError, ValueError):
|
||||
continue
|
||||
payload = cast(dict[str, Any], payload)
|
||||
event_type = payload.get("type", "")
|
||||
if event_type == "error":
|
||||
msg = payload.get("message", "unknown error")
|
||||
@@ -503,7 +504,7 @@ async def _post_with_retry(
|
||||
type(payload).__name__,
|
||||
)
|
||||
return ""
|
||||
return extract_text(payload)
|
||||
return extract_text(cast(dict[str, Any], payload))
|
||||
return ""
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user