From 916170eb7ada71e5b37676cc02b5a1d3131c9162 Mon Sep 17 00:00:00 2001 From: jxxghp Date: Fri, 16 Oct 2026 23:49:24 +0800 Subject: [PATCH] refactor(types): govern TMDb certification response contract --- .../themoviedb/tmdbv3api/objs/certification.py | 12 +++++++----- mypy.ini | 1 + 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/modules/themoviedb/tmdbv3api/objs/certification.py b/app/modules/themoviedb/tmdbv3api/objs/certification.py index e41b02e6c..a1aea3c57 100644 --- a/app/modules/themoviedb/tmdbv3api/objs/certification.py +++ b/app/modules/themoviedb/tmdbv3api/objs/certification.py @@ -1,34 +1,36 @@ -from ..tmdb import TMDb +from ..tmdb import TMDb, TMDbJson class Certification(TMDb): + """提供电影与剧集分级查询,保留服务端 JSON 字段。""" + _urls = { "movie_list": "/certification/movie/list", "tv_list": "/certification/tv/list", } - def movie_list(self): + def movie_list(self) -> TMDbJson: """ Get an up to date list of the officially supported movie certifications on TMDB. :return: """ return self._request_obj(self._urls["movie_list"], key="certifications") - async def async_movie_list(self): + async def async_movie_list(self) -> TMDbJson: """ Get an up to date list of the officially supported movie certifications on TMDB.(异步版本) :return: """ return await self._async_request_obj(self._urls["movie_list"], key="certifications") - def tv_list(self): + def tv_list(self) -> TMDbJson: """ Get an up to date list of the officially supported TV show certifications on TMDB. :return: """ return self._request_obj(self._urls["tv_list"], key="certifications") - async def async_tv_list(self): + async def async_tv_list(self) -> TMDbJson: """ Get an up to date list of the officially supported TV show certifications on TMDB.(异步版本) :return: diff --git a/mypy.ini b/mypy.ini index 0ea26fbf4..48cc91abd 100644 --- a/mypy.ini +++ b/mypy.ini @@ -176,4 +176,5 @@ files = app/modules/themoviedb/tmdbv3api/objs/auth.py, app/modules/themoviedb/tmdbv3api/objs/list.py, app/modules/themoviedb/tmdbv3api/objs/genre.py, + app/modules/themoviedb/tmdbv3api/objs/certification.py, scripts/architecture/async_blocking.py