fix(architecture): satisfy ruff/mypy ratchets for media auxiliary

e02418bac 把新导入放在 settings = RuntimeSettingsCompat() 之后,
导致 5 个模块 E402 诊断超出只降不增基线;同时 media_auxiliary
把工厂函数 MetaInfo 误用作返回类型标注。将新增导入移回赋值语句
之前,返回类型修正为 MetaBase。
This commit is contained in:
jxxghp
2026-08-26 14:33:36 +08:00
parent df2ce103e1
commit cdab54254d
6 changed files with 42 additions and 46 deletions
+7 -8
View File
@@ -1,15 +1,14 @@
from threading import Lock
from typing import Optional, Tuple, Union, cast
from app.runtime.settings import RuntimeSettingsCompat
settings = RuntimeSettingsCompat()
from app.domain.context import MediaInfo
from app.domain.media import is_media_source_enabled
from app.domain.meta.metabase import MetaBase
from app.runtime.execution import run_in_threadpool
from app.runtime.settings import get_runtime_setting
from app.modules import _ModuleBase
from app.modules.thetvdb import tvdb_v4_official
from app.runtime.execution import run_in_threadpool
from app.runtime.log import logger
from app.schemas.types import (
MediaRecognizeType,
@@ -39,11 +38,11 @@ class TheTvDbModule(_ModuleBase):
action = "刷新" if is_retry else "创建"
logger.info(f"开始{action}TVDB登录会话...")
try:
if not settings.TVDB_V4_API_KEY:
if not get_runtime_setting("TVDB_V4_API_KEY"):
raise ConnectionError("TVDB API Key 未配置,无法初始化会话。")
self.tvdb = tvdb_v4_official.TVDB(apikey=settings.TVDB_V4_API_KEY,
pin=settings.TVDB_V4_API_PIN,
proxy=settings.PROXY,
self.tvdb = tvdb_v4_official.TVDB(apikey=get_runtime_setting("TVDB_V4_API_KEY"),
pin=get_runtime_setting("TVDB_V4_API_PIN"),
proxy=get_runtime_setting("PROXY"),
timeout=self.__timeout)
if self.tvdb:
logger.info(f"TVDB登录会话{action}成功。")