refactor: 统一代码格式,调整多行代码换行风格

对多个文件进行代码格式化调整,将长行参数拆分为多行书写,提升代码可读性,包括:
- 调整函数定义、调用的多行换行格式
- 优化列表、元组、字典的多行排版
- 新增README.md项目说明文档
This commit is contained in:
2026-07-30 14:25:12 +08:00
parent dce9e31bde
commit fdb664e546
10 changed files with 491 additions and 49 deletions
+6 -2
View File
@@ -102,7 +102,9 @@ def _parse_pdf(content: bytes) -> str:
if not settings.pdf_ocr_enabled:
return ""
ocr_text = _ocr_pdf(content, max_pages=settings.pdf_ocr_max_pages, dpi=settings.pdf_ocr_dpi)
ocr_text = _ocr_pdf(
content, max_pages=settings.pdf_ocr_max_pages, dpi=settings.pdf_ocr_dpi
)
return ocr_text
@@ -143,7 +145,9 @@ def _ocr_pdf(content: bytes, max_pages: int, dpi: int) -> str:
result, _ = _ocr_engine(pil_image)
if result:
# result: [[box, text, score], ...],按行拼接
lines = [item[1] for item in result if item and len(item) >= 2 and item[1]]
lines = [
item[1] for item in result if item and len(item) >= 2 and item[1]
]
if lines:
page_texts.append("\n".join(lines))
pdf.close()