From: Jc2k Date: Mon, 20 Jan 2025 20:49:22 +0000 (+0000) Subject: chore: add mypy for hass (#1891) X-Git-Url: https://git.kitaultman.com/?a=commitdiff_plain;h=c01500383e2286b0a96d8ff584fbbd2b07f4bdf8;p=music-assistant-server.git chore: add mypy for hass (#1891) --- diff --git a/music_assistant/providers/hass/__init__.py b/music_assistant/providers/hass/__init__.py index 0d620365..34ed0c6f 100644 --- a/music_assistant/providers/hass/__init__.py +++ b/music_assistant/providers/hass/__init__.py @@ -35,7 +35,7 @@ if TYPE_CHECKING: from music_assistant_models.config_entries import ProviderConfig from music_assistant_models.provider import ProviderManifest - from music_assistant import MusicAssistant + from music_assistant.mass import MusicAssistant from music_assistant.models import ProviderInstanceType DOMAIN = "hass" @@ -66,9 +66,9 @@ async def get_config_entries( values: the (intermediate) raw values for config entries sent with the action. """ # config flow auth action/step (authenticate button clicked) - if action == CONF_ACTION_AUTH: + if action == CONF_ACTION_AUTH and values: hass_url = values[CONF_URL] - async with AuthenticationHelper(mass, values["session_id"]) as auth_helper: + async with AuthenticationHelper(mass, str(values["session_id"])) as auth_helper: client_id = base_url(auth_helper.callback_url) auth_url = get_auth_url( hass_url, @@ -170,7 +170,7 @@ class HomeAssistant(PluginProvider): """Home Assistant Plugin for Music Assistant.""" hass: HomeAssistantClient - _listen_task: asyncio.Task | None = None + _listen_task: asyncio.Task[None] | None = None async def handle_async_init(self) -> None: """Handle async initialization of the plugin.""" diff --git a/pyproject.toml b/pyproject.toml index 998ef08d..510cccab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -127,7 +127,6 @@ exclude = [ '^music_assistant/providers/chromecast/.*$', '^music_assistant/providers/deezer/.*$', '^music_assistant/providers/dlna/.*$', - '^music_assistant/providers/hass/.*$', '^music_assistant/providers/hass_players/.*$', '^music_assistant/providers/player_group/.*$', '^music_assistant/providers/podcastfeed/.*$',