fix: auto-fix code issues (cron)
- 修复重复导入/字段 - 修复异常处理 - 修复PEP8格式问题 - 添加类型注解
This commit is contained in:
@@ -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)}")
|
||||
|
||||
Reference in New Issue
Block a user