From b002432691fcdeb453e1ade5d6ddc1c7da96e1b5 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Fri, 16 Oct 2026 23:49:41 +0800 Subject: [PATCH] refactor(types): govern TMDb credit response contract --- app/modules/themoviedb/tmdbv3api/objs/credit.py | 8 +++++--- mypy.ini | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/modules/themoviedb/tmdbv3api/objs/credit.py b/app/modules/themoviedb/tmdbv3api/objs/credit.py index 7518078e0..af61f9eec 100644 --- a/app/modules/themoviedb/tmdbv3api/objs/credit.py +++ b/app/modules/themoviedb/tmdbv3api/objs/credit.py @@ -1,12 +1,14 @@ -from ..tmdb import TMDb +from ..tmdb import TMDb, TMDbJson class Credit(TMDb): + """按身份标识查询电影或剧集演职员详情。""" + _urls = { "details": "/credit/%s" } - def details(self, credit_id): + def details(self, credit_id: int | str) -> TMDbJson: """ Get a movie or TV credit details by id. :param credit_id: int @@ -14,7 +16,7 @@ class Credit(TMDb): """ return self._request_obj(self._urls["details"] % credit_id) - async def async_details(self, credit_id): + async def async_details(self, credit_id: int | str) -> TMDbJson: """ Get a movie or TV credit details by id.(异步版本) :param credit_id: int diff --git a/mypy.ini b/mypy.ini index 7c2428527..92fe6c757 100644 --- a/mypy.ini +++ b/mypy.ini @@ -179,4 +179,5 @@ files = app/modules/themoviedb/tmdbv3api/objs/certification.py, app/modules/themoviedb/tmdbv3api/objs/configuration.py, app/modules/themoviedb/tmdbv3api/objs/provider.py, + app/modules/themoviedb/tmdbv3api/objs/credit.py, scripts/architecture/async_blocking.py