From 6a86e31b9771e5375cf7fe7bacb723f48982d9f7 Mon Sep 17 00:00:00 2001 From: OzGav Date: Tue, 30 Sep 2025 22:34:46 +1000 Subject: [PATCH] mypy fixes for Spotify provider (#2436) * mypy fixes for Spotify provider * Update pyproject.toml * Update music_assistant/providers/spotify/provider.py Co-authored-by: Marcel van der Veldt * Update music_assistant/providers/spotify/provider.py Co-authored-by: Marcel van der Veldt * Apply suggestion from @marcelveldt Co-authored-by: Marcel van der Veldt --------- Co-authored-by: Marcel van der Veldt Co-authored-by: Maxim Raznatovski --- music_assistant/providers/spotify/provider.py | 6 +++--- pyproject.toml | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/music_assistant/providers/spotify/provider.py b/music_assistant/providers/spotify/provider.py index 2db42088..9da24abb 100644 --- a/music_assistant/providers/spotify/provider.py +++ b/music_assistant/providers/spotify/provider.py @@ -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 diff --git a/pyproject.toml b/pyproject.toml index 02edd8f6..51f9adf1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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/.*$', ] -- 2.34.1