Files
douyin_guaji-main/douyin/detection/detection_pkg/__init__.py
T
CodexandClaude Opus 4.7 787c4e8eec 拆分 douyin_detection (1756 → 3 个子模块 + 22 行 shim)
把 douyin/detection/douyin_detection.py 按职责拆成
douyin/detection/detection_pkg/ 子包:

- _common (14)    _ensure_detection_cache 共享缓存初始化
- detail (323)    check_detail_height + check_in_fudai_detail(详情页相关)
- finder (1438)   check_have_fudai_with_ready_screenshot(找福袋图标主入口,最大头)

原文件改为 22 行 re-export shim,4 个公共符号全部保留。
- check_in_fudai_detail 5 处外部引用
- check_have_fudai_with_ready_screenshot 3 处外部引用
- check_detail_height 2 处外部引用
全部不需修改。

子包名 detection_pkg 是为了避免与同目录下的 shim 文件 douyin_detection.py
潜在的命名混淆。

回归:
- 4 个新文件 + shim compileall 通过
- pytest 353 passed / 1 skipped
- 旧 import 路径与新子包路径返回同一函数对象

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-21 16:55:24 +08:00

24 lines
737 B
Python

"""detection_pkg - 福袋检测子包。
原 douyin/detection/douyin_detection.py 拆成 3 个子模块:
- _common _ensure_detection_cache
- detail check_detail_height / check_in_fudai_detail
- finder check_have_fudai_with_ready_screenshot(最大头)
外部 import 路径不变:
``from douyin.detection.douyin_detection import check_in_fudai_detail`` 仍可用
(原文件改成 re-export shim)。
"""
from ._common import _ensure_detection_cache
from .detail import check_detail_height, check_in_fudai_detail
from .finder import check_have_fudai_with_ready_screenshot
__all__ = [
"_ensure_detection_cache",
"check_detail_height",
"check_have_fudai_with_ready_screenshot",
"check_in_fudai_detail",
]