Fix lint_mypy (#352)

* Add type ignore for stop_word attribute assignment

Added type ignore comment for stop_word attribute.

* Refactor exception handling in disconnect process

Updated exception handling to use pylint directive for broad exceptions.

* Fix callback lambda for broadcasting state
This commit is contained in:
Omar Amin authored and GitHub committed 2026-07-16 03:38:40 +03:00
1 parent d811ae75d4
commit 2c9c1d2b8a
2 files changed
+5 -5

No files matched your search

+2 -2
View File
@@ -122,7 +122,7 @@ class MediaPlayerEntity(ESPHomeEntity):
self.announce_player.play( self.announce_player.play(
url, url,
done_callback=lambda: call_all( done_callback=lambda: call_all(
self._broadcast_state([self._update_state(MediaPlayerState.IDLE)]), lambda: self._broadcast_state([self._update_state(MediaPlayerState.IDLE)]),
done_callback, done_callback,
), ),
) )
@@ -132,7 +132,7 @@ class MediaPlayerEntity(ESPHomeEntity):
self.music_player.play( self.music_player.play(
url, url,
done_callback=lambda: call_all( done_callback=lambda: call_all(
self._broadcast_state([self._update_state(MediaPlayerState.IDLE)]), lambda: self._broadcast_state([self._update_state(MediaPlayerState.IDLE)]),
done_callback, done_callback,
), ),
) )
+3 -3
View File
@@ -1027,15 +1027,15 @@ class VoiceSatelliteProtocol(APIServer):
# Stop any ongoing audio playback and wake/stop word processing. # Stop any ongoing audio playback and wake/stop word processing.
try: try:
self.state.music_player.stop() self.state.music_player.stop()
except Exception: # pragma: no cover - defensive safety net except Exception: # pylint: disable=broad-except
_LOGGER.exception("Failed to stop music player during disconnect") _LOGGER.exception("Failed to stop music player during disconnect")
try: try:
self.state.tts_player.stop() self.state.tts_player.stop()
except Exception: # pragma: no cover - defensive safety net except Exception: # pylint: disable=broad-except
_LOGGER.exception("Failed to stop TTS player during disconnect") _LOGGER.exception("Failed to stop TTS player during disconnect")
self.state.stop_word.is_active = False self.state.stop_word.is_active = False # type: ignore[attr-defined]
self.state.connected = False self.state.connected = False
if self.state.satellite is self: if self.state.satellite is self: