修复福袋详情OCR v2与调试日志

This commit is contained in:
Your Name committed 2026-06-03 01:22:13 +08:00
1 parent 2c6f024a24
commit 1d37d57c90
119 files changed
+5582 -767

No files matched your search

+35 -12
View File
@@ -4,6 +4,17 @@
对外仍统一通过本包导出符号,避免下游代码直接耦合到内部子模块路径。
"""
from __future__ import annotations
def _missing_dep_stub(symbol_name: str, exc: Exception):
def _raise(*args, **kwargs): # noqa: ANN002, ANN003
raise RuntimeError(
f"{symbol_name} 不可用:缺少运行时依赖或导入失败 ({type(exc).__name__}: {exc})"
) from exc
return _raise
# 从子模块导入
from .ocr_operations import (
analyse_pic_word,
@@ -11,20 +22,32 @@ from .ocr_operations import (
extract_ocr_content,
_ensure_ocr,
)
from .screenshot_operations import (
get_screenshot,
_find_pic_path,
cut_pic,
save_reward_pic,
)
try:
from .screenshot_operations import (
get_screenshot,
_find_pic_path,
cut_pic,
save_reward_pic,
)
except Exception as exc:
get_screenshot = _missing_dep_stub("get_screenshot", exc)
_find_pic_path = _missing_dep_stub("_find_pic_path", exc)
cut_pic = _missing_dep_stub("cut_pic", exc)
save_reward_pic = _missing_dep_stub("save_reward_pic", exc)
# 从原始大文件再导出,保持向后兼容;新代码请优先使用上面的子模块导入。
from douyin.core.underlying_operations import (
_safe_replace_file,
_ensure_parent_dir,
_mirror_screenshot_to_external,
underlying_operations,
)
try:
from douyin.core.underlying_operations import (
_safe_replace_file,
_ensure_parent_dir,
_mirror_screenshot_to_external,
underlying_operations,
)
except Exception as exc:
_safe_replace_file = _missing_dep_stub("_safe_replace_file", exc)
_ensure_parent_dir = _missing_dep_stub("_ensure_parent_dir", exc)
_mirror_screenshot_to_external = _missing_dep_stub("_mirror_screenshot_to_external", exc)
underlying_operations = _missing_dep_stub("underlying_operations", exc)
__all__ = [
# OCR相关