refactor: 完整重构 data_process 模块并修复拆分遗留缺陷
将 algorithms.py / store.py 拆分为 algorithms/ 与 store/ 子包,并修复 机械拆分造成的导入与辅助函数缺失: - algorithms/: 补全各子模块依赖与 17 个私有辅助函数、8 个常量;重写 __init__.py 移除坏的 importlib 兜底,分层导入并以局部 import 断开 text_utils<->parsers、quality<->structured_processing 循环依赖。 - store/: 补回 DataProcessStoreError / hashlib / _serialize_value / estimate_token_count 等缺失导入,包入口导出测试与调用方依赖的私有 辅助函数。 - 删除旧单文件 algorithms.py / store.py 及重构残留(_algorithms_old、 backups、refactor 脚本、REFACTORING 文档)。 algorithms 与 store 测试套件 91 项全部通过。
This commit is contained in:
@@ -1 +1,16 @@
|
||||
"""Data processing module."""
|
||||
"""数据处理模块。
|
||||
|
||||
本模块已重构为多个子模块以提高可维护性:
|
||||
|
||||
- store/: 数据持久层,拆分自原 store.py (2869行 → 8个文件)
|
||||
- algorithms/: 算法和解析器,拆分自原 algorithms.py (3330行 → 11个文件)
|
||||
|
||||
使用方式:
|
||||
from app.modules.data_process.store import DataProcessStore
|
||||
from app.modules.data_process.algorithms import estimate_token_count
|
||||
"""
|
||||
|
||||
# 注意:为了避免循环导入,不在此处导入所有内容
|
||||
# 请直接从子模块导入所需功能
|
||||
|
||||
__all__ = ["store", "algorithms"]
|
||||
|
||||
Reference in New Issue
Block a user