mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
refactor(chain): 处理链功能域 mixin 化,清理未使用导入并根治兼容层循环导入
- ChainBase 拆分为 RecognitionMixin/MessageProcessingMixin/NotificationMixin - TransferChain 拆分为 7 个功能 mixin(_mixins.py),SubscribeChain 音乐订阅域拆出 _music.py - 斜杠命令交互四件套收敛为 InteractionChainMixin 委托,会话管理器移至 application 层,chain 层不再 re-export - 模块基础类收敛到 app/modules/_base(notification/mediaserver 语义重命名) - 清理 app/chain/__init__.py 24 个未使用导入,修正 49 处测试 patch 目标到实际命名空间 - 兼容层 legacy 符号不再并入 __all__,根治 schemas 初始化反向拉起 application.transfer 的循环导入 - 修复 bangumi 集数为字符串时 set_bangumi_info 抛 TypeError - 新增重复代码等架构门禁测试;capability 清单校验排除下划线内部目录
This commit is contained in:
@@ -36,12 +36,12 @@ def _patch_transfer_planning(monkeypatch, chain, fileitem, history, planned, del
|
||||
monkeypatch.setattr(chain, "_TransferChain__put_to_jobview", lambda task: True)
|
||||
monkeypatch.setattr(
|
||||
chain,
|
||||
"_TransferChain__register_scrape_batch_task",
|
||||
"_register_scrape_batch_task",
|
||||
lambda task: None,
|
||||
)
|
||||
monkeypatch.setattr(
|
||||
chain,
|
||||
"_TransferChain__close_scrape_batch",
|
||||
"_close_scrape_batch",
|
||||
lambda batch_id: None,
|
||||
)
|
||||
|
||||
@@ -62,6 +62,7 @@ def _patch_transfer_planning(monkeypatch, chain, fileitem, history, planned, del
|
||||
"app.chain.transfer.TransferHistoryOper",
|
||||
lambda: history_oper,
|
||||
)
|
||||
monkeypatch.setattr("app.chain._mixins.TransferHistoryOper", lambda: history_oper)
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.DownloadHistoryOper",
|
||||
lambda: SimpleNamespace(
|
||||
@@ -71,10 +72,17 @@ def _patch_transfer_planning(monkeypatch, chain, fileitem, history, planned, del
|
||||
get_by_path=lambda path: None,
|
||||
),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._mixins.DownloadHistoryOper", lambda: SimpleNamespace(
|
||||
get_by_hash=lambda download_hash: None,
|
||||
get_file_by_fullpath=lambda fullpath: None,
|
||||
get_files_by_savepath=lambda savepath: [],
|
||||
get_by_path=lambda path: None,
|
||||
))
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.SystemConfigOper",
|
||||
lambda: SimpleNamespace(get=lambda key: None),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._mixins.SystemConfigOper", lambda: SimpleNamespace(get=lambda key: None))
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.StorageChain",
|
||||
lambda: SimpleNamespace(
|
||||
@@ -85,6 +93,13 @@ def _patch_transfer_planning(monkeypatch, chain, fileitem, history, planned, del
|
||||
or True,
|
||||
),
|
||||
)
|
||||
monkeypatch.setattr("app.chain._mixins.StorageChain", lambda: SimpleNamespace(
|
||||
exists=lambda current_fileitem: True,
|
||||
delete_media_file=lambda current_fileitem: deleted.append(
|
||||
("target", current_fileitem.path)
|
||||
)
|
||||
or True,
|
||||
))
|
||||
monkeypatch.setattr(
|
||||
"app.chain.transfer.MetaInfoPath",
|
||||
lambda path, custom_words=None, **kwargs: FakeMeta(1),
|
||||
|
||||
Reference in New Issue
Block a user