diff --git a/app/modules/themoviedb/tmdbv3api/objs/collection.py b/app/modules/themoviedb/tmdbv3api/objs/collection.py index 8699e7770..aac64d89f 100644 --- a/app/modules/themoviedb/tmdbv3api/objs/collection.py +++ b/app/modules/themoviedb/tmdbv3api/objs/collection.py @@ -1,3 +1,5 @@ +from typing import cast + from ..tmdb import TMDb, TMDbJson @@ -8,13 +10,16 @@ class Collection(TMDb): "translations": "/collection/%s/translations" } - def details(self, collection_id: int | str) -> TMDbJson: + def details(self, collection_id: int | str) -> list[dict[str, TMDbJson]]: """ Get collection details by id. :param collection_id: int :return: """ - return self._request_obj(self._urls["details"] % collection_id, key="parts") + return cast( + list[dict[str, TMDbJson]], + self._request_obj(self._urls["details"] % collection_id, key="parts"), + ) def images(self, collection_id: int | str) -> TMDbJson: """ @@ -33,13 +38,22 @@ class Collection(TMDb): return self._request_obj(self._urls["translations"] % collection_id, key="translations") # 异步版本方法 - async def async_details(self, collection_id: int | str) -> TMDbJson: + async def async_details( + self, + collection_id: int | str, + ) -> list[dict[str, TMDbJson]]: """ Get collection details by id.(异步版本) :param collection_id: int :return: """ - return await self._async_request_obj(self._urls["details"] % collection_id, key="parts") + return cast( + list[dict[str, TMDbJson]], + await self._async_request_obj( + self._urls["details"] % collection_id, + key="parts", + ), + ) async def async_images(self, collection_id: int | str) -> TMDbJson: """