refactor: 移除 doc 和 ppt reader 支持
移除对旧版 .doc 和 .ppt 格式的支持,以简化项目架构和减少维护负担。 变更内容: - 删除 scripts/readers/doc/ 目录 - 删除 scripts/readers/ppt/ 目录 - 从 readers/__init__.py 中移除 DocReader 和 PptReader - 从 utils/file_detection.py 中移除 is_valid_doc 和 is_valid_ppt - 从 config.py 中移除 doc 和 ppt 依赖配置 - 从 advice_generator.py 中移除相关映射 - 更新 CLI 帮助文档 - 更新 README.md 文档 - 删除相关测试用例 - 删除相关规范文档
This commit is contained in:
@@ -5,9 +5,7 @@ from .file_detection import (
|
||||
is_valid_pptx,
|
||||
is_valid_xlsx,
|
||||
is_valid_pdf,
|
||||
is_valid_doc,
|
||||
is_valid_xls,
|
||||
is_valid_ppt,
|
||||
is_html_file,
|
||||
is_url,
|
||||
)
|
||||
@@ -17,9 +15,7 @@ __all__ = [
|
||||
"is_valid_pptx",
|
||||
"is_valid_xlsx",
|
||||
"is_valid_pdf",
|
||||
"is_valid_doc",
|
||||
"is_valid_xls",
|
||||
"is_valid_ppt",
|
||||
"is_html_file",
|
||||
"is_url",
|
||||
]
|
||||
|
||||
@@ -6,7 +6,7 @@ from typing import List, Optional
|
||||
|
||||
|
||||
def _is_valid_ole(file_path: str) -> bool:
|
||||
"""验证 OLE2 格式文件(DOC/XLS/PPT)"""
|
||||
"""验证 OLE2 格式文件(XLS)"""
|
||||
try:
|
||||
import olefile
|
||||
except ImportError:
|
||||
@@ -48,21 +48,11 @@ def is_valid_xlsx(file_path: str) -> bool:
|
||||
return _is_valid_ooxml(file_path, _XLSX_REQUIRED)
|
||||
|
||||
|
||||
def is_valid_doc(file_path: str) -> bool:
|
||||
"""验证文件是否为有效的 DOC 格式"""
|
||||
return _is_valid_ole(file_path)
|
||||
|
||||
|
||||
def is_valid_xls(file_path: str) -> bool:
|
||||
"""验证文件是否为有效的 XLS 格式"""
|
||||
return _is_valid_ole(file_path)
|
||||
|
||||
|
||||
def is_valid_ppt(file_path: str) -> bool:
|
||||
"""验证文件是否为有效的 PPT 格式"""
|
||||
return _is_valid_ole(file_path)
|
||||
|
||||
|
||||
def is_valid_pdf(file_path: str) -> bool:
|
||||
"""验证文件是否为有效的 PDF 格式"""
|
||||
try:
|
||||
@@ -82,7 +72,3 @@ def is_html_file(file_path: str) -> bool:
|
||||
def is_url(input_str: str) -> bool:
|
||||
"""判断输入是否为 URL"""
|
||||
return input_str.startswith("http://") or input_str.startswith("https://")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user