Files
douyin_guaji-main/douyin/reservation/douyin_reservation_logic.py
T
CodexandClaude Opus 4.7 74209035f7 拆分 douyin_reservation_logic (2702 → 7 个子模块 + 53 行 shim)
把 douyin/reservation/douyin_reservation_logic.py 按职责拆成
douyin/reservation/reservation_logic/ 子包:

- _common (57)             共享错误处理工具占位 + ReservationItem 类型
- helpers (130)            内部工具:标题归一化 / 相似度 / 排序 / 时间戳
- add (447)                add_reservation_core_logic 主入口(添加新预约)
- cleanup_validate (136)   validate_back_to_reservation / cleanup_expired_reservations
- queue_full (305)         handle_queue_full_wait_at_earliest 队列满时等待策略
- attend_window (1437)     process_reservation_attend_window 进入预约窗口(最大头)
- record (328)             record_high_value_reservation 高价值预约登记入口

原文件改为 53 行 re-export shim,17 个公共符号全部保留。
- process_reservation_attend_window 7 处外部引用
- handle_queue_full_wait_at_earliest 5 处外部引用
- _now_ts 5 处 / cleanup_expired_reservations 4 处 / _sort_reservations_inplace 4 处
- 其他 5 处以下
全部不需修改。

回归:
- 8 个新文件 + shim compileall 通过
- pytest 353 passed / 1 skipped
- 旧 import 路径与新子包路径返回同一函数对象
- _now_ts / _normalize_room_title / _calculate_string_similarity 等纯函数
  调用结果与拆分前一致

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

54 lines
2.0 KiB
Python

"""douyin_reservation_logic - 兼容入口(保留外部 import 路径)。
实际实现位于子包 ``douyin.reservation.reservation_logic``。
本文件仅 re-export 公共符号;详见各子模块文档:
- ``reservation_logic._common`` 共享错误处理工具 + ReservationItem 类型
- ``reservation_logic.helpers`` 内部工具:标题归一化 / 相似度 / 排序
- ``reservation_logic.add`` add_reservation_core_logic 主入口
- ``reservation_logic.cleanup_validate`` validate_back_to_reservation / cleanup_expired_reservations
- ``reservation_logic.queue_full`` handle_queue_full_wait_at_earliest
- ``reservation_logic.attend_window`` process_reservation_attend_window(最大头)
- ``reservation_logic.record`` record_high_value_reservation
"""
from douyin.reservation.reservation_logic import (
ReservationItem,
_RESERVATION_ERROR_UTILS_AVAILABLE,
_calculate_string_similarity,
_extract_content_core,
_normalize_room_title_for_matching,
_now_ts,
_sort_reservations_inplace,
add_reservation_core_logic,
cleanup_expired_reservations,
format_reservation_context,
handle_queue_full_wait_at_earliest,
log_reservation_error,
process_reservation_attend_window,
record_high_value_reservation,
safe_write_state,
validate_back_to_reservation,
validate_reservation_item,
)
__all__ = [
"ReservationItem",
"_RESERVATION_ERROR_UTILS_AVAILABLE",
"log_reservation_error",
"safe_write_state",
"format_reservation_context",
"validate_reservation_item",
"_now_ts",
"_normalize_room_title_for_matching",
"_calculate_string_similarity",
"_extract_content_core",
"_sort_reservations_inplace",
"add_reservation_core_logic",
"validate_back_to_reservation",
"cleanup_expired_reservations",
"handle_queue_full_wait_at_earliest",
"process_reservation_attend_window",
"record_high_value_reservation",
]