A fourth pass over low-error-count files. Drops 8 files (57 → 49) and full-pyright errors from 525 → 496. Default pyright stays clean. Optional access on transport/client receivers (4 files). Same fix shape as #4359 — a receiver typed `X | None` accessed without a guard. For "should never happen" cases (caller's lifecycle ensures the field is non-None when the method runs), used `assert` rather than silent early-return so an invariant violation surfaces loudly: - `transports/whatsapp/client.py` (5 errors): `_validate_whatsapp_webhook_request` was typed `bytes` / `str` but called with `bytes | None` / `str | None`. Widened the helper signature and pushed the explicit None-check inside (matching its existing empty-string check). Also handled `pipecat_connection.get_answer()` returning `None` — would have crashed at `.get("sdp")` before. - `transports/websocket/client.py` (5 errors): four are the deprecated `websockets.WebSocketClientProtocol` alias (same `# pyright: ignore[reportAttributeAccessIssue]` as the `services/websocket_service.py` fix from earlier in this PR). The fifth was `async for message in self._websocket` — traced the call chain and confirmed `_client_task` is created only after `self._websocket` is assigned and cancelled before it's cleared, so the field is never None when `_client_task_handler` runs. Used `assert`. - `services/openai/stt.py` (4 errors): same pattern. `_receive_messages` is started by `_connect()` only when `self._websocket` is set, and the reconnect loop in `WebsocketService._receive_task_handler` re-establishes it before each retry. `assert` at entry. Plus L478/L483: the `try`/`except ModuleNotFoundError` import-guard makes `websocket_connect` and `State` `<type> | None`; `__init__` already raises `ImportError` if either is None, so an `assert` at the `_connect_websocket` use site is honest. Plus an L538 `Language | str` cast (same shape as last batch). - `services/deepgram/flux/base.py` (2 errors): `event = data.get("event")` flowed into `_handle_turn_resumed(event: str)` as `Any | None`. Tightened with an `isinstance(event, str)` guard before the `FluxEventType(event)` lookup. The other error (`average_confidence > min_confidence` where `min_confidence: float | None`) was a latent crash on missing confidence data — restored the original `not min_confidence` (which treats both `None` and `0.0` as "no filter") and added an explicit drop-on-missing-confidence-data branch. `gemini_live` Settings/InputParams (vertex). The deprecated `InputParams` declares `modalities: GeminiModalities | None` and `media_resolution: GeminiMediaResolution | None`, but their downstream usage at `services/google/gemini_live/llm.py:952,959` calls `.value` on each — `None` would crash. Rather than touching the deprecated input model, translate `None` to the canonical defaults (`GeminiModalities.AUDIO`, `GeminiMediaResolution.UNSPECIFIED`) at the assignment site in `vertex/llm.py`. Also fixed an unrelated annotation bug: `_get_credentials` was annotated `-> str` but actually returns `service_account.Credentials` (used correctly by the caller — only the annotation was wrong). `moondream/vision.py` (3 errors). `frame.format` is `str | None` but `Image.frombytes(mode, ...)` requires `str`; raise instead of crashing on missing format. The other two errors are pyright thinking the moondream2-custom `encode_image` and `query` methods are `Tensor` (rather than callables) — those are provided by the model code via `trust_remote_code=True` and aren't visible to pyright on the base `AutoModelForCausalLM` type. Scoped `# pyright: ignore[reportCallIssue]` on the two call sites. `transports/base_output.py` (3 errors). Two are `self._mixer.mix(...)` calls in `with_mixer`, a closure invoked only when `self._mixer` is truthy at the call site — captured the mixer to a local variable inside the closure with an `assert`, then used that. Third is the PIL `frombytes(mode, ...)` shape — `frame.format is None` early- return guard at the top of `resize_frame` so the main resize logic reads cleanly. `elevenlabs/tts.py` (4 errors). The payload-building dict at L1271 was typed `dict[str, str | dict[str, float | bool]]` — an aspirational shape that matched only the first two assignments. Subsequent code assigned `list[dict[...]]` (pronunciation locators) and bools, all violating the annotation. Same pattern at L926 (the WebSocket-init `msg`). Both widened to `dict[str, Any]`, which is the honest shape for a JSON request payload and what similar code uses elsewhere. Files dropped from the ignore list (57 → 49): services/deepgram/flux/base.py, services/elevenlabs/tts.py, services/google/gemini_live/vertex/llm.py, services/moondream/vision.py, services/openai/stt.py, transports/base_output.py, transports/websocket/client.py, transports/whatsapp/client.py.
60 lines
2.5 KiB
JSON
60 lines
2.5 KiB
JSON
{
|
|
"typeCheckingMode": "basic",
|
|
"pythonVersion": "3.11",
|
|
"pythonPlatform": "All",
|
|
"include": ["scripts", "src/pipecat"],
|
|
"exclude": ["**/*_pb2.py", "**/__pycache__"],
|
|
"ignore": [
|
|
"tests",
|
|
"src/pipecat/audio/filters/aic_filter.py",
|
|
"src/pipecat/audio/filters/krisp_viva_filter.py",
|
|
"src/pipecat/audio/turn/smart_turn/local_smart_turn_v2.py",
|
|
"src/pipecat/audio/turn/smart_turn/local_smart_turn_v3.py",
|
|
"src/pipecat/audio/vad/silero.py",
|
|
"src/pipecat/processors/aggregators/llm_response_universal.py",
|
|
"src/pipecat/processors/frame_processor.py",
|
|
"src/pipecat/processors/frameworks/rtvi/observer.py",
|
|
"src/pipecat/services/anthropic/llm.py",
|
|
"src/pipecat/services/aws/llm.py",
|
|
"src/pipecat/services/aws/nova_sonic/llm.py",
|
|
"src/pipecat/services/aws/sagemaker/bidi_client.py",
|
|
"src/pipecat/services/azure/tts.py",
|
|
"src/pipecat/services/deepgram/flux/sagemaker/stt.py",
|
|
"src/pipecat/services/deepgram/sagemaker/stt.py",
|
|
"src/pipecat/services/deepgram/sagemaker/tts.py",
|
|
"src/pipecat/services/google/gemini_live/llm.py",
|
|
"src/pipecat/services/google/llm.py",
|
|
"src/pipecat/services/google/stt.py",
|
|
"src/pipecat/services/google/tts.py",
|
|
"src/pipecat/services/heygen/client.py",
|
|
"src/pipecat/services/heygen/video.py",
|
|
"src/pipecat/services/inworld/realtime/llm.py",
|
|
"src/pipecat/services/llm_service.py",
|
|
"src/pipecat/services/mem0/memory.py",
|
|
"src/pipecat/services/mistral/tts.py",
|
|
"src/pipecat/services/nvidia/stt.py",
|
|
"src/pipecat/services/nvidia/tts.py",
|
|
"src/pipecat/services/openai/base_llm.py",
|
|
"src/pipecat/services/openai/realtime/llm.py",
|
|
"src/pipecat/services/rime/tts.py",
|
|
"src/pipecat/services/sambanova/llm.py",
|
|
"src/pipecat/services/sarvam/stt.py",
|
|
"src/pipecat/services/simli/video.py",
|
|
"src/pipecat/services/speechmatics/stt.py",
|
|
"src/pipecat/services/stt_service.py",
|
|
"src/pipecat/services/tavus/video.py",
|
|
"src/pipecat/services/tts_service.py",
|
|
"src/pipecat/services/ultravox/llm.py",
|
|
"src/pipecat/services/whisper/stt.py",
|
|
"src/pipecat/services/xai/realtime/llm.py",
|
|
"src/pipecat/transports/daily/transport.py",
|
|
"src/pipecat/transports/lemonslice/transport.py",
|
|
"src/pipecat/transports/livekit/transport.py",
|
|
"src/pipecat/transports/smallwebrtc/connection.py",
|
|
"src/pipecat/transports/smallwebrtc/transport.py",
|
|
"src/pipecat/transports/tavus/transport.py",
|
|
"src/pipecat/transports/websocket/server.py"
|
|
],
|
|
"reportMissingImports": false
|
|
}
|