refactor: 移除 BaseReader 中未使用的 supported_extensions 属性

从 BaseReader 抽象基类及所有 Reader 子类中移除 supported_extensions
属性,该属性在代码库中从未被实际调用,仅作为元数据存在。
This commit is contained in:
2026-03-08 22:56:32 +08:00
parent 7eab1dcef1
commit 09904aefdc
6 changed files with 0 additions and 26 deletions

View File

@@ -8,12 +8,6 @@ from typing import List, Optional, Tuple
class BaseReader(ABC): class BaseReader(ABC):
"""文档阅读器基类。""" """文档阅读器基类。"""
@property
@abstractmethod
def supported_extensions(self) -> List[str]:
"""返回支持的文件扩展名列表(如 ['.docx', '.doc'])。"""
pass
@abstractmethod @abstractmethod
def supports(self, file_path: str) -> bool: def supports(self, file_path: str) -> bool:
""" """

View File

@@ -27,10 +27,6 @@ PARSERS = [
class DocxReader(BaseReader): class DocxReader(BaseReader):
"""DOCX 文件阅读器""" """DOCX 文件阅读器"""
@property
def supported_extensions(self) -> List[str]:
return [".docx"]
def supports(self, file_path: str) -> bool: def supports(self, file_path: str) -> bool:
return file_path.lower().endswith('.docx') return file_path.lower().endswith('.docx')

View File

@@ -26,10 +26,6 @@ PARSERS = [
class HtmlReader(BaseReader): class HtmlReader(BaseReader):
"""HTML/URL 文件阅读器""" """HTML/URL 文件阅读器"""
@property
def supported_extensions(self) -> List[str]:
return [".html", ".htm"]
def supports(self, file_path: str) -> bool: def supports(self, file_path: str) -> bool:
return is_url(file_path) or file_path.lower().endswith(('.html', '.htm')) return is_url(file_path) or file_path.lower().endswith(('.html', '.htm'))

View File

@@ -27,10 +27,6 @@ PARSERS = [
class PdfReader(BaseReader): class PdfReader(BaseReader):
"""PDF 文件阅读器""" """PDF 文件阅读器"""
@property
def supported_extensions(self) -> List[str]:
return [".pdf"]
def supports(self, file_path: str) -> bool: def supports(self, file_path: str) -> bool:
return file_path.lower().endswith('.pdf') return file_path.lower().endswith('.pdf')

View File

@@ -25,10 +25,6 @@ PARSERS = [
class PptxReader(BaseReader): class PptxReader(BaseReader):
"""PPTX 文件阅读器""" """PPTX 文件阅读器"""
@property
def supported_extensions(self) -> List[str]:
return [".pptx"]
def supports(self, file_path: str) -> bool: def supports(self, file_path: str) -> bool:
return file_path.lower().endswith('.pptx') return file_path.lower().endswith('.pptx')

View File

@@ -25,10 +25,6 @@ PARSERS = [
class XlsxReader(BaseReader): class XlsxReader(BaseReader):
"""XLSX 文件阅读器""" """XLSX 文件阅读器"""
@property
def supported_extensions(self) -> List[str]:
return [".xlsx"]
def supports(self, file_path: str) -> bool: def supports(self, file_path: str) -> bool:
return file_path.lower().endswith('.xlsx') return file_path.lower().endswith('.xlsx')