Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
refactor(audio): TYPE_CHECKING import for sounddevice type annotations (H4 nit)
Ruben Lütke932045f298f9
diff --git a/jarvis/audio/capture.py b/jarvis/audio/capture.pyindex cff756fb9b..7c61bf3242 100644--- a/jarvis/audio/capture.py+++ b/jarvis/audio/capture.py@@ -12,14 +12,20 @@ from __future__ import annotationsimport asyncioimport timefrom collections.abc import AsyncIterator+from typing import TYPE_CHECKINGimport numpy as npfrom loguru import logger as _log-try:+if TYPE_CHECKING:+ # Type-checkers see the real module so `sd.InputStream` annotations resolve;+ # at runtime the guarded import below binds sd (or None when absent).import sounddevice as sd-except Exception: # noqa: BLE001 — sounddevice/PortAudio (libportaudio2) absent (headless/slim)- sd = None # type: ignore[assignment]+else:+ try:+ import sounddevice as sd+ except Exception: # noqa: BLE001 — sounddevice/PortAudio (libportaudio2) absent (headless/slim)+ sd = None # type: ignore[assignment]from jarvis.core.protocols import AudioChunkdiff --git a/jarvis/audio/player.py b/jarvis/audio/player.pyindex 9032011a7d..b1cbcd1f41 100644--- a/jarvis/audio/player.py+++ b/jarvis/audio/player.py@@ -12,14 +12,19 @@ import asyncioimport loggingimport timefrom collections.abc import AsyncIterator-from typing import Any+from typing import TYPE_CHECKING, Anyimport numpy as np-try:+if TYPE_CHECKING:+ # Type-checkers see the real module so `sd.OutputStream` annotations resolve;+ # at runtime the guarded import below binds sd (or None when absent).import sounddevice as sd-except Exception: # noqa: BLE001 — sounddevice/PortAudio (libportaudio2) absent (headless/slim)- sd = None # type: ignore[assignment]+else:+ try:+ import sounddevice as sd+ except Exception: # noqa: BLE001 — sounddevice/PortAudio (libportaudio2) absent (headless/slim)+ sd = None # type: ignore[assignment]from jarvis.audio import level_tapfrom jarvis.core.events import AudioOutFirst