fix: auto-fix code issues (cron)

- 修复重复导入/字段
- 修复异常处理
- 修复PEP8格式问题
- 添加类型注解
This commit is contained in:
AutoFix Bot
2026-03-03 06:03:38 +08:00
parent 2a0ed6af4d
commit 9fd1da8fb7
41 changed files with 901 additions and 768 deletions

View File

@@ -35,7 +35,7 @@ class DocumentProcessor:
if ext not in self.supported_formats:
raise ValueError(
f"Unsupported file format: {ext}. Supported: {list(self.supported_formats.keys())}"
f"Unsupported file format: {ext}. Supported: {list(self.supported_formats.keys())}",
)
extractor = self.supported_formats[ext]
@@ -75,7 +75,7 @@ class DocumentProcessor:
return "\n\n".join(text_parts)
except ImportError:
raise ImportError(
"PDF processing requires PyPDF2 or pdfplumber. Install with: pip install PyPDF2"
"PDF processing requires PyPDF2 or pdfplumber. Install with: pip install PyPDF2",
)
except Exception as e:
raise ValueError(f"PDF extraction failed: {str(e)}")
@@ -106,7 +106,7 @@ class DocumentProcessor:
return "\n\n".join(text_parts)
except ImportError:
raise ImportError(
"DOCX processing requires python-docx. Install with: pip install python-docx"
"DOCX processing requires python-docx. Install with: pip install python-docx",
)
except Exception as e:
raise ValueError(f"DOCX extraction failed: {str(e)}")