mypy fixes for Spotify provider (#2436)
authorOzGav <gavnosp@hotmail.com>
Tue, 30 Sep 2025 12:34:46 +0000 (22:34 +1000)
committerGitHub <noreply@github.com>
Tue, 30 Sep 2025 12:34:46 +0000 (14:34 +0200)
* mypy fixes for Spotify provider

* Update pyproject.toml

* Update music_assistant/providers/spotify/provider.py

Co-authored-by: Marcel van der Veldt <m.vanderveldt@outlook.com>
* Update music_assistant/providers/spotify/provider.py

Co-authored-by: Marcel van der Veldt <m.vanderveldt@outlook.com>
* Apply suggestion from @marcelveldt

Co-authored-by: Marcel van der Veldt <m.vanderveldt@outlook.com>
---------

Co-authored-by: Marcel van der Veldt <m.vanderveldt@outlook.com>
Co-authored-by: Maxim Raznatovski <nda.mr43@gmail.com>
music_assistant/providers/spotify/provider.py
pyproject.toml

index 2db42088eb5f1fe4312b28c15bee1373697922b8..9da24abbf96c92091e7de47be8e8dbb2f3bd402b 100644 (file)
@@ -6,7 +6,7 @@ import asyncio
 import os
 import time
 from collections.abc import AsyncGenerator
-from typing import Any
+from typing import Any, cast
 
 import aiohttp
 from music_assistant_models.enums import (
@@ -956,7 +956,7 @@ class SpotifyProvider(MusicProvider):
                 break
 
     async def _get_data_with_caching(
-        self, endpoint: str, cache_checksum: str, **kwargs: Any
+        self, endpoint: str, cache_checksum: str | None, **kwargs: Any
     ) -> dict[str, Any]:
         """Get data from api with caching."""
         cache_key_parts = [endpoint]
@@ -966,7 +966,7 @@ class SpotifyProvider(MusicProvider):
         if cached := await self.mass.cache.get(
             cache_key, provider=self.instance_id, checksum=cache_checksum, allow_bypass=False
         ):
-            return cached
+            return cast("dict[str, Any]", cached)
         result = await self._get_data(endpoint, **kwargs)
         await self.mass.cache.set(
             cache_key, result, provider=self.instance_id, checksum=cache_checksum
index 02edd8f675e151e1a297b3db3e043a87d802c977..51f9adf16081c9872967df963ba8ae3600e0d65e 100644 (file)
@@ -145,7 +145,6 @@ exclude = [
   '^music_assistant/providers/sonos/.*$',
   '^music_assistant/providers/soundcloud/.*$',
   '^music_assistant/providers/snapcast/.*$',
-  '^music_assistant/providers/spotify/.*$',
   '^music_assistant/providers/tunein/.*$',
   '^music_assistant/providers/ytmusic/.*$',
 ]