 CodexandClaude Opus 4.7
|
01034347f4
|
refactor(finder): 抽 check_have_fudai_with_ready_screenshot 中"numpy 加速水平带扫描"块到 finder_numpy_scan
将 127 行的 numpy 加速扫描块抽到独立模块。
使用 numpy 批量处理,从最优位置向左右两侧交替搜索福袋图标的特征颜色。
helper 接受 (analyser, detected, detected_x, pic_new, width, height, rx, ry,
y_pianyi_val, optimal_x_scaled),返回更新后的 (detected, detected_x)。
finder.py: 553 → 435 行 (-118)
新增 finder_numpy_scan.py: 156 行
finder.py 跌破 500 行(1438 → 435,本会话累计削减 1003 行 = -70%)
验证:
- pytest 1013 passed
- compile OK
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 13:24:50 +08:00 |
|
 CodexandClaude Opus 4.7
|
e3daeab024
|
refactor(finder): 抽 check_have_fudai_with_ready_screenshot 中"逐像素扫描兜底"块到 finder_pixel_scan
将 183 行的"numpy 未命中时的原始逐像素检查"块抽到独立模块。
保留了原代码"找到后退出外层 while 循环"的 break 语义(在调用方
检查返回的 detected 后 break)。
finder.py: 726 → 553 行 (-173)
新增 finder_pixel_scan.py: 207 行
finder.py 跌破 600 行(1438 → 553,本会话累计削减 885 行 = -62%)
验证:
- pytest 1013 passed
- compile OK
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 13:22:20 +08:00 |
|
 CodexandClaude Opus 4.7
|
411fd96804
|
refactor(finder): 抽 check_have_fudai_with_ready_screenshot 中"模板匹配兜底"块到 finder_template_match
将 226 行的"OpenCV 模板匹配兜底"独立块抽到独立模块。
当像素检测未命中时,调用 cv2.matchTemplate 在指定区域查找福袋图标。
helper 接受 (analyser, detected, detected_x, pic_new, width, height, rx, ry,
y_pianyi_val, loop) 参数,返回更新后的 (detected, detected_x)。
finder.py: 944 → 726 行 (-218)
新增 finder_template_match.py: 257 行
finder.py 跌破 800 行(1438 → 726,本会话累计削减 712 行 = -50%)
验证:
- pytest 1013 passed
- compile OK
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 13:17:18 +08:00 |
|
 CodexandClaude Opus 4.7
|
b9f0389e58
|
chore(finder): 删除 check_have_fudai_with_ready_screenshot 中 return False 之后的不可达死代码
第 938-1431 行(共 494 行)位于函数 return 语句之后,永远不会执行。
这是早期像素检测改用模板匹配后的遗留代码。函数末尾的模块级注释
"像素检测代码已删除,使用模板匹配替代" 已说明该段代码无用。
验证:
- AST 解析通过
- pytest 1013 passed
- 函数边界从 19-1431 缩到 19-936
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
2026-05-22 07:54:25 +08:00 |
|
 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 |
|