13 lines
429 B
Python
13 lines
429 B
Python
"""文档处理器抽象(扩展接口 3:同步 → 异步任务)。"""
|
|
|
|
from typing import Protocol, runtime_checkable
|
|
|
|
|
|
@runtime_checkable
|
|
class DocumentProcessor(Protocol):
|
|
"""文档处理统一接口。业务代码通过此接口处理文档,不直接写解析逻辑。"""
|
|
|
|
def process(self, document_id: str) -> None:
|
|
"""处理文档:解析 → 提取元数据 → 保存 Markdown。"""
|
|
...
|