Transforms complex documents like PDFs and Office docs into LLM-ready markdown/JSON for your Agentic workflows.
Python ai4sciencedocument-analysisdocxextract-datalayout-analysisocrparserpdfpdf-converterpdf-extractor-llmpdf-extractor-pretrainpdf-extractor-ragpdf-parserpptxpythonxlsx
feat: add Flash model and update import paths for native PDF handling
myhlolic27c173fd250
diff --git a/mineru/backend/flash/pdf_extractor.py b/mineru/backend/flash/pdf_extractor.pyindex 7c57cb12..39911e5b 100644--- a/mineru/backend/flash/pdf_extractor.py+++ b/mineru/backend/flash/pdf_extractor.py@@ -2,7 +2,7 @@"""Flash PDF 公共提取入口。-原生文本处理位于 native_pdf 内部包;需要 OCR 时统一委托 Hybrid low。+原生文本处理由 FlashModel 提供;需要 OCR 时统一委托 Hybrid low。"""from __future__ import annotations@@ -59,12 +59,10 @@ def doc_analyze(resolved_mode = parse_modeif resolved_mode == "txt":- # 延迟加载原生分析流水线,使逐页纯文本接口保持轻量。- from mineru.backend.flash.native_pdf.pipeline import (- _analyze_native_document,- )+ # 延迟加载 FlashModel,使逐页纯文本和 OCR 路径保持轻量。+ from mineru.model.flash import FlashModel- return _analyze_native_document(pdf_doc)+ return FlashModel().predict(pdf_doc)# OCR 路径延迟加载 Hybrid,保证原生 Flash 不引入本地视觉模型运行时。from mineru.backend.hybrid.analyze import doc_analyze as hybrid_doc_analyzediff --git a/mineru/backend/office/docx_analyze.py b/mineru/backend/office/docx_analyze.pyindex 584a9781..1e2ba252 100644--- a/mineru/backend/office/docx_analyze.py+++ b/mineru/backend/office/docx_analyze.py@@ -5,7 +5,7 @@ from typing import Anyfrom loguru import logger-from ...model.docx.main import convert_binary+from ...model.flash.docx.main import convert_binaryfrom ...types import PageInfofrom ...utils.image_payload import ImagePayloadCachefrom .model_output_to_middle_json import result_to_middle_jsondiff --git a/mineru/backend/office/pptx_analyze.py b/mineru/backend/office/pptx_analyze.pyindex b3d23fcd..bbc61ff4 100644--- a/mineru/backend/office/pptx_analyze.py+++ b/mineru/backend/office/pptx_analyze.py@@ -7,7 +7,7 @@ from typing import Anyfrom loguru import logger-from ...model.pptx.main import convert_binary+from ...model.flash.pptx.main import convert_binaryfrom ...types import PageInfofrom ...utils.image_payload import ImagePayloadCachefrom .model_output_to_middle_json import result_to_middle_jsondiff --git a/mineru/backend/office/xlsx_analyze.py b/mineru/backend/office/xlsx_analyze.pyindex d03bd272..e1705d95 100644--- a/mineru/backend/office/xlsx_analyze.py+++ b/mineru/backend/office/xlsx_analyze.py@@ -7,7 +7,7 @@ from typing import Anyfrom loguru import logger-from ...model.xlsx.main import convert_binary+from ...model.flash.xlsx.main import convert_binaryfrom ...types import PageInfofrom ...utils.image_payload import ImagePayloadCachefrom .model_output_to_middle_json import result_to_middle_jsondiff --git a/mineru/model/flash/__init__.py b/mineru/model/flash/__init__.pynew file mode 100644index 00000000..3126d171--- /dev/null+++ b/mineru/model/flash/__init__.py@@ -0,0 +1,7 @@+# Copyright (c) Opendatalab. All rights reserved.++"""Flash 原生 PDF 模型入口。"""++from .model import FlashModel++__all__ = ["FlashModel"]diff --git a/mineru/model/docx/__init__.py b/mineru/model/flash/docx/__init__.pysimilarity index 100%rename from mineru/model/docx/__init__.pyrename to mineru/model/flash/docx/__init__.pydiff --git a/mineru/model/docx/docx_converter.py b/mineru/model/flash/docx/docx_converter.pysimilarity index 99%rename from mineru/model/docx/docx_converter.pyrename to mineru/model/flash/docx/docx_converter.pyindex 8d66afd7..de45ae27 100644--- a/mineru/model/docx/docx_converter.py+++ b/mineru/model/flash/docx/docx_converter.py@@ -21,9 +21,9 @@ from mineru.backend.utils.office_chart import extract_chart_html_from_ooxmlfrom mineru.backend.utils.office_image import (serialize_office_image,)-from mineru.model.docx.package_normalizer import normalize_docx_package-from mineru.model.docx.tools.math.omml import oMath2Latex-from mineru.model.docx.tools.office_xml import read_str+from mineru.model.flash.docx.package_normalizer import normalize_docx_package+from mineru.model.flash.docx.tools.math.omml import oMath2Latex+from mineru.model.flash.docx.tools.office_xml import read_strfrom mineru.types import BlockTypefrom mineru.utils.docx_formatting import Formatting, Scriptfrom mineru.utils.office_rich_text import (diff --git a/mineru/model/docx/main.py b/mineru/model/flash/docx/main.pysimilarity index 96%rename from mineru/model/docx/main.pyrename to mineru/model/flash/docx/main.pyindex fe5a2315..16905185 100644--- a/mineru/model/docx/main.py+++ b/mineru/model/flash/docx/main.py@@ -1,7 +1,7 @@# Copyright (c) Opendatalab. All rights reserved.from typing import BinaryIO-from mineru.model.docx.docx_converter import DocxConverter+from mineru.model.flash.docx.docx_converter import DocxConverterdef convert_path(file_path: str):diff --git a/mineru/model/docx/package_normalizer.py b/mineru/model/flash/docx/package_normalizer.pysimilarity index 100%rename from mineru/model/docx/package_normalizer.pyrename to mineru/model/flash/docx/package_normalizer.pydiff --git a/mineru/model/docx/tools/__init__.py b/mineru/model/flash/docx/tools/__init__.pysimilarity index 100%rename from mineru/model/docx/tools/__init__.pyrename to mineru/model/flash/docx/tools/__init__.pydiff --git a/mineru/model/docx/tools/math/__init__.py b/mineru/model/flash/docx/tools/math/__init__.pysimilarity index 100%rename from mineru/model/docx/tools/math/__init__.pyrename to mineru/model/flash/docx/tools/math/__init__.pydiff --git a/mineru/model/docx/tools/math/latex_dict.py b/mineru/model/flash/docx/tools/math/latex_dict.pysimilarity index 100%rename from mineru/model/docx/tools/math/latex_dict.pyrename to mineru/model/flash/docx/tools/math/latex_dict.pydiff --git a/mineru/model/docx/tools/math/omml.py b/mineru/model/flash/docx/tools/math/omml.pysimilarity index 100%rename from mineru/model/docx/tools/math/omml.pyrename to mineru/model/flash/docx/tools/math/omml.pydiff --git a/mineru/model/docx/tools/office_xml.py b/mineru/model/flash/docx/tools/office_xml.pysimilarity index 100%rename from mineru/model/docx/tools/office_xml.pyrename to mineru/model/flash/docx/tools/office_xml.pydiff --git a/mineru/model/flash/model.py b/mineru/model/flash/model.pynew file mode 100644index 00000000..f8bd204b--- /dev/null+++ b/mineru/model/flash/model.py@@ -0,0 +1,20 @@+# Copyright (c) Opendatalab. All rights reserved.++"""Flash 原生 PDF 提取模型。"""++from __future__ import annotations++from typing import Any++from mineru.utils.pdf_document import PDFDocument++from .native_pdf import pipeline+++class FlashModel:+ """将 Flash 原生 PDF 流水线包装为无状态模型。"""++ def predict(self, pdf_doc: PDFDocument) -> list[list[dict[str, Any]]]:+ """分析调用方持有的 PDFDocument,并原样返回分页 model_list。"""++ return pipeline._analyze_native_document(pdf_doc)diff --git a/mineru/backend/flash/native_pdf/__init__.py b/mineru/model/flash/native_pdf/__init__.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/__init__.pyrename to mineru/model/flash/native_pdf/__init__.pydiff --git a/mineru/backend/flash/native_pdf/auxiliary_text.py b/mineru/model/flash/native_pdf/auxiliary_text.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/auxiliary_text.pyrename to mineru/model/flash/native_pdf/auxiliary_text.pydiff --git a/mineru/backend/flash/native_pdf/code_blocks.py b/mineru/model/flash/native_pdf/code_blocks.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/code_blocks.pyrename to mineru/model/flash/native_pdf/code_blocks.pydiff --git a/mineru/backend/flash/native_pdf/formulas.py b/mineru/model/flash/native_pdf/formulas.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/formulas.pyrename to mineru/model/flash/native_pdf/formulas.pydiff --git a/mineru/backend/flash/native_pdf/geometry.py b/mineru/model/flash/native_pdf/geometry.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/geometry.pyrename to mineru/model/flash/native_pdf/geometry.pydiff --git a/mineru/backend/flash/native_pdf/graphics.py b/mineru/model/flash/native_pdf/graphics.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/graphics.pyrename to mineru/model/flash/native_pdf/graphics.pydiff --git a/mineru/backend/flash/native_pdf/index_blocks.py b/mineru/model/flash/native_pdf/index_blocks.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/index_blocks.pyrename to mineru/model/flash/native_pdf/index_blocks.pydiff --git a/mineru/backend/flash/native_pdf/line_layout.py b/mineru/model/flash/native_pdf/line_layout.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/line_layout.pyrename to mineru/model/flash/native_pdf/line_layout.pydiff --git a/mineru/backend/flash/native_pdf/line_merging.py b/mineru/model/flash/native_pdf/line_merging.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/line_merging.pyrename to mineru/model/flash/native_pdf/line_merging.pydiff --git a/mineru/backend/flash/native_pdf/models.py b/mineru/model/flash/native_pdf/models.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/models.pyrename to mineru/model/flash/native_pdf/models.pydiff --git a/mineru/backend/flash/native_pdf/native_text.py b/mineru/model/flash/native_pdf/native_text.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/native_text.pyrename to mineru/model/flash/native_pdf/native_text.pydiff --git a/mineru/backend/flash/native_pdf/pipeline.py b/mineru/model/flash/native_pdf/pipeline.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/pipeline.pyrename to mineru/model/flash/native_pdf/pipeline.pydiff --git a/mineru/backend/flash/native_pdf/tables.py b/mineru/model/flash/native_pdf/tables.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/tables.pyrename to mineru/model/flash/native_pdf/tables.pydiff --git a/mineru/backend/flash/native_pdf/text_blocks.py b/mineru/model/flash/native_pdf/text_blocks.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/text_blocks.pyrename to mineru/model/flash/native_pdf/text_blocks.pydiff --git a/mineru/backend/flash/native_pdf/titles.py b/mineru/model/flash/native_pdf/titles.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/titles.pyrename to mineru/model/flash/native_pdf/titles.pydiff --git a/mineru/backend/flash/native_pdf/visual_annotations.py b/mineru/model/flash/native_pdf/visual_annotations.pysimilarity index 100%rename from mineru/backend/flash/native_pdf/visual_annotations.pyrename to mineru/model/flash/native_pdf/visual_annotations.pydiff --git a/mineru/model/pptx/__init__.py b/mineru/model/flash/pptx/__init__.pysimilarity index 100%rename from mineru/model/pptx/__init__.pyrename to mineru/model/flash/pptx/__init__.pydiff --git a/mineru/model/pptx/main.py b/mineru/model/flash/pptx/main.pysimilarity index 86%rename from mineru/model/pptx/main.pyrename to mineru/model/flash/pptx/main.pyindex d9effd36..05474b59 100644--- a/mineru/model/pptx/main.py+++ b/mineru/model/flash/pptx/main.py@@ -1,7 +1,7 @@# Copyright (c) Opendatalab. All rights reserved.from typing import BinaryIO-from mineru.model.pptx.pptx_converter import PptxConverter+from mineru.model.flash.pptx.pptx_converter import PptxConverterdef convert_path(file_path: str):diff --git a/mineru/model/pptx/package_normalizer.py b/mineru/model/flash/pptx/package_normalizer.pysimilarity index 100%rename from mineru/model/pptx/package_normalizer.pyrename to mineru/model/flash/pptx/package_normalizer.pydiff --git a/mineru/model/pptx/pptx_converter.py b/mineru/model/flash/pptx/pptx_converter.pysimilarity index 99%rename from mineru/model/pptx/pptx_converter.pyrename to mineru/model/flash/pptx/pptx_converter.pyindex 6a64a290..236d542b 100644--- a/mineru/model/pptx/pptx_converter.py+++ b/mineru/model/flash/pptx/pptx_converter.py@@ -14,10 +14,10 @@ from pptx.oxml.text import CT_TextLineBreakfrom mineru.backend.utils.office_chart import extract_chart_html_from_ooxmlfrom mineru.backend.utils.office_image import PIL_IMAGE_LOAD_ERRORS, is_vector_image, serialize_vector_image_with_placeholder-from mineru.model.docx.tools.math.omml import oMath2Latex+from mineru.model.flash.docx.tools.math.omml import oMath2Latexfrom mineru.model.office_stream import read_stream_bytes_from_start, rewind_stream-from mineru.model.pptx.package_normalizer import normalize_pptx_package-from mineru.model.pptx.xycut_pp_sorter import sort_entries+from mineru.model.flash.pptx.package_normalizer import normalize_pptx_package+from mineru.model.flash.pptx.xycut_pp_sorter import sort_entriesfrom mineru.types import BlockTypefrom mineru.utils.office_rich_text import OfficeRichTextSegment, build_rich_text_from_segmentsfrom mineru.utils.pdf_reader import image_to_b64strdiff --git a/mineru/model/pptx/xycut_pp_sorter.py b/mineru/model/flash/pptx/xycut_pp_sorter.pysimilarity index 100%rename from mineru/model/pptx/xycut_pp_sorter.pyrename to mineru/model/flash/pptx/xycut_pp_sorter.pydiff --git a/mineru/model/xlsx/__init__.py b/mineru/model/flash/xlsx/__init__.pysimilarity index 100%rename from mineru/model/xlsx/__init__.pyrename to mineru/model/flash/xlsx/__init__.pydiff --git a/mineru/model/xlsx/main.py b/mineru/model/flash/xlsx/main.pysimilarity index 86%rename from mineru/model/xlsx/main.pyrename to mineru/model/flash/xlsx/main.pyindex b0190f51..e9b4bded 100644--- a/mineru/model/xlsx/main.py+++ b/mineru/model/flash/xlsx/main.py@@ -1,7 +1,7 @@# Copyright (c) Opendatalab. All rights reserved.from typing import BinaryIO-from mineru.model.xlsx.xlsx_converter import XlsxConverter+from mineru.model.flash.xlsx.xlsx_converter import XlsxConverterdef convert_path(file_path: str):diff --git a/mineru/model/xlsx/package_normalizer.py b/mineru/model/flash/xlsx/package_normalizer.pysimilarity index 100%rename from mineru/model/xlsx/package_normalizer.pyrename to mineru/model/flash/xlsx/package_normalizer.pydiff --git a/mineru/model/xlsx/xlsx_converter.py b/mineru/model/flash/xlsx/xlsx_converter.pysimilarity index 99%rename from mineru/model/xlsx/xlsx_converter.pyrename to mineru/model/flash/xlsx/xlsx_converter.pyindex b1c02830..49b1025c 100644--- a/mineru/model/xlsx/xlsx_converter.py+++ b/mineru/model/flash/xlsx/xlsx_converter.py@@ -20,9 +20,9 @@ from pydantic import BaseModel, Field, NonNegativeInt, PositiveIntfrom pydantic.dataclasses import dataclassfrom mineru.backend.utils.office_image import is_vector_image, serialize_vector_image_with_placeholder-from mineru.model.docx.tools.math.omml import oMath2Latex+from mineru.model.flash.docx.tools.math.omml import oMath2Latexfrom mineru.model.office_stream import read_stream_bytes_from_start, rewind_stream-from mineru.model.xlsx.package_normalizer import normalize_xlsx_package+from mineru.model.flash.xlsx.package_normalizer import normalize_xlsx_packagefrom mineru.types import BlockTypefrom mineru.utils.pdf_reader import image_to_b64strdiff --git a/tests/unittest/_flash_pdf_test_utils.py b/tests/unittest/_flash_pdf_test_utils.pyindex 6208f820..a1201bee 100644--- a/tests/unittest/_flash_pdf_test_utils.py+++ b/tests/unittest/_flash_pdf_test_utils.py@@ -2,7 +2,7 @@ from __future__ import annotations-from mineru.backend.flash.native_pdf import (+from mineru.model.flash.native_pdf import (models,)diff --git a/tests/unittest/test_flash_model.py b/tests/unittest/test_flash_model.pynew file mode 100644index 00000000..2c8dfc75--- /dev/null+++ b/tests/unittest/test_flash_model.py@@ -0,0 +1,36 @@+from __future__ import annotations++import importlib+from unittest.mock import MagicMock++import pytest++from mineru.model.flash import FlashModel+from mineru.model.flash.native_pdf import pipeline+from mineru.utils.pdf_document import PDFDocument+++def test_flash_model_predict_returns_native_model_list_without_owning_document(+ monkeypatch: pytest.MonkeyPatch,+) -> None:+ """验证模型传递同一 PDFDocument,且不负责分类或关闭调用方文档。"""++ pdf_doc = MagicMock(spec=PDFDocument)+ expected_model_list = [[{"type": "text", "content": "native"}]]+ native_analyze = MagicMock(return_value=expected_model_list)+ monkeypatch.setattr(pipeline, "_analyze_native_document", native_analyze)++ result = FlashModel().predict(pdf_doc)++ assert result is expected_model_list+ native_analyze.assert_called_once_with(pdf_doc)+ pdf_doc.classify.assert_not_called()+ pdf_doc.close.assert_not_called()+++def test_flash_model_is_public_and_old_native_pdf_import_is_removed() -> None:+ """验证新模型入口公开可用,旧 backend native_pdf 路径不再兼容。"""++ assert importlib.import_module("mineru.model.flash").FlashModel is FlashModel+ with pytest.raises(ModuleNotFoundError):+ importlib.import_module("mineru.backend.flash.native_pdf")diff --git a/tests/unittest/test_flash_office_models.py b/tests/unittest/test_flash_office_models.pynew file mode 100644index 00000000..b3e8da59--- /dev/null+++ b/tests/unittest/test_flash_office_models.py@@ -0,0 +1,59 @@+import importlib.util+from collections.abc import Callable+from pathlib import Path+from typing import Any, BinaryIO++import pytest++from mineru.backend.office.docx_analyze import office_docx_analyze+from mineru.backend.office.pptx_analyze import office_pptx_analyze+from mineru.backend.office.xlsx_analyze import office_xlsx_analyze+from mineru.model.flash.docx.main import convert_binary as convert_docx+from mineru.model.flash.pptx.main import convert_binary as convert_pptx+from mineru.model.flash.xlsx.main import convert_binary as convert_xlsx+from mineru.parser.office import DocxParser, PptxParser, XlsxParser+++_OFFICE_SAMPLE_DIR = Path(__file__).resolve().parents[2] / "demo" / "office_docs"+++ ("suffix", "converter", "expected_pages", "expected_module"),+ [+ ("docx", convert_docx, 3, "mineru.model.flash.docx.main"),+ ("pptx", convert_pptx, 6, "mineru.model.flash.pptx.main"),+ ("xlsx", convert_xlsx, 3, "mineru.model.flash.xlsx.main"),+ ],+)+def test_flash_office_model_conversion(+ suffix: str,+ converter: Callable[[BinaryIO], list[dict[str, Any]]],+ expected_pages: int,+ expected_module: str,+) -> None:+ """验证迁移后的 Office 模型入口与真实样例转换结果保持不变。"""++ sample_path = _OFFICE_SAMPLE_DIR / f"{suffix}_01.{suffix}"+ with sample_path.open("rb") as stream:+ pages = converter(stream)++ assert converter.__module__ == expected_module+ assert len(pages) == expected_pages+++def test_office_parsers_bind_existing_analyzers() -> None:+ """验证三个 Office Parser 仍绑定原有的后端分析入口。"""++ assert DocxParser()._analyze_fn is office_docx_analyze+ assert PptxParser()._analyze_fn is office_pptx_analyze+ assert XlsxParser()._analyze_fn is office_xlsx_analyze+++ "module_name",+ ["mineru.model.docx", "mineru.model.pptx", "mineru.model.xlsx"],+)+def test_legacy_office_model_paths_are_removed(module_name: str) -> None:+ """验证迁移后不再暴露旧的 Office 模型包路径。"""++ assert importlib.util.find_spec(module_name) is Nonediff --git a/tests/unittest/test_flash_pdf_auxiliary_text.py b/tests/unittest/test_flash_pdf_auxiliary_text.pyindex cdab8977..29bdd6b3 100644--- a/tests/unittest/test_flash_pdf_auxiliary_text.py+++ b/tests/unittest/test_flash_pdf_auxiliary_text.py@@ -4,7 +4,7 @@ import inspectimport pytest-from mineru.backend.flash.native_pdf import (+from mineru.model.flash.native_pdf import (auxiliary_text,models,pipeline,diff --git a/tests/unittest/test_flash_pdf_code_blocks.py b/tests/unittest/test_flash_pdf_code_blocks.pyindex dad38e96..fc1bf0d1 100644--- a/tests/unittest/test_flash_pdf_code_blocks.py+++ b/tests/unittest/test_flash_pdf_code_blocks.py@@ -4,7 +4,7 @@ from typing import Anyimport pytest-from mineru.backend.flash.native_pdf import code_blocks, models, pipeline+from mineru.model.flash.native_pdf import code_blocks, models, pipelinefrom mineru.backend.hybrid.table_text import project_pdf_spatial_textfrom mineru.utils.pdf_document import PDFPathInfodiff --git a/tests/unittest/test_flash_pdf_document_profile.py b/tests/unittest/test_flash_pdf_document_profile.pyindex e29264a4..0b9e86c4 100644--- a/tests/unittest/test_flash_pdf_document_profile.py+++ b/tests/unittest/test_flash_pdf_document_profile.py@@ -1,6 +1,6 @@from __future__ import annotations-from mineru.backend.flash.native_pdf import titles+from mineru.model.flash.native_pdf import titlesfrom _flash_pdf_test_utils import _prepared_text_page, _text_linediff --git a/tests/unittest/test_flash_pdf_extractor.py b/tests/unittest/test_flash_pdf_extractor.pyindex 005f0575..934e3896 100644--- a/tests/unittest/test_flash_pdf_extractor.py+++ b/tests/unittest/test_flash_pdf_extractor.py@@ -8,7 +8,8 @@ from unittest.mock import MagicMockimport pytestfrom mineru.backend.flash import pdf_extractor-from mineru.backend.flash.native_pdf import (+from mineru.model.flash import FlashModel+from mineru.model.flash.native_pdf import (pipeline,)@@ -107,8 +108,8 @@ def test_txt_mode_keeps_native_flash_path(monkeypatch,classified_mode="txt",)- native_analyze = MagicMock(return_value=expected_model_list)- monkeypatch.setattr(pipeline, "_analyze_native_document", native_analyze)+ native_predict = MagicMock(return_value=expected_model_list)+ monkeypatch.setattr(FlashModel, "predict", native_predict)hybrid_doc_analyze = _install_hybrid_analyze(monkeypatch,model_list=[[{"type": "text", "content": "unexpected"}]],@@ -121,8 +122,10 @@ def test_txt_mode_keeps_native_flash_path(assert result is expected_model_listassert pdf_doc.classify.call_count == expected_classify_calls- native_analyze.assert_called_once_with(pdf_doc)+ native_predict.assert_called_once_with(pdf_doc)hybrid_doc_analyze.assert_not_called()++def test_invalid_parse_mode_is_rejected_before_opening_pdf(monkeypatch: pytest.MonkeyPatch) -> None:"""验证非法解析模式在打开 PDF 前保持原有报错行为。"""diff --git a/tests/unittest/test_flash_pdf_formulas.py b/tests/unittest/test_flash_pdf_formulas.pyindex e823d360..f6765e16 100644--- a/tests/unittest/test_flash_pdf_formulas.py+++ b/tests/unittest/test_flash_pdf_formulas.py@@ -5,7 +5,7 @@ from dataclasses import replaceimport pytest-from mineru.backend.flash.native_pdf import (+from mineru.model.flash.native_pdf import (formulas,geometry,line_merging,diff --git a/tests/unittest/test_flash_pdf_graphics.py b/tests/unittest/test_flash_pdf_graphics.pyindex 24ccad9b..947057aa 100644--- a/tests/unittest/test_flash_pdf_graphics.py+++ b/tests/unittest/test_flash_pdf_graphics.py@@ -5,7 +5,7 @@ import inspectimport pytest-from mineru.backend.flash.native_pdf import (+from mineru.model.flash.native_pdf import (graphics,models,pipeline,diff --git a/tests/unittest/test_flash_pdf_index_blocks.py b/tests/unittest/test_flash_pdf_index_blocks.pyindex 1cb2961b..9bed081d 100644--- a/tests/unittest/test_flash_pdf_index_blocks.py+++ b/tests/unittest/test_flash_pdf_index_blocks.py@@ -2,7 +2,7 @@ from __future__ import annotationsimport pytest-from mineru.backend.flash.native_pdf import index_blocks+from mineru.model.flash.native_pdf import index_blocksfrom _flash_pdf_test_utils import _text_linediff --git a/tests/unittest/test_flash_pdf_native_text.py b/tests/unittest/test_flash_pdf_native_text.pyindex f2d66ac5..235b5194 100644--- a/tests/unittest/test_flash_pdf_native_text.py+++ b/tests/unittest/test_flash_pdf_native_text.py@@ -5,7 +5,7 @@ from typing import Anyimport pytest-from mineru.backend.flash.native_pdf import native_text+from mineru.model.flash.native_pdf import native_textdef _span(diff --git a/tests/unittest/test_flash_pdf_pipeline.py b/tests/unittest/test_flash_pdf_pipeline.pyindex 8f0a3bca..ac7b8130 100644--- a/tests/unittest/test_flash_pdf_pipeline.py+++ b/tests/unittest/test_flash_pdf_pipeline.py@@ -6,7 +6,8 @@ import inspectimport pytestfrom mineru.backend.flash import pdf_extractor-from mineru.backend.flash.native_pdf import (+from mineru.model.flash import FlashModel+from mineru.model.flash.native_pdf import (auxiliary_text,formulas,geometry,@@ -187,6 +188,7 @@ def test_flash_extractor_has_no_local_ocr_runtime_logic() -> None:inspect.getsource(module)for module in (pdf_extractor,+ FlashModel,auxiliary_text,formulas,geometry,diff --git a/tests/unittest/test_flash_pdf_samples.py b/tests/unittest/test_flash_pdf_samples.pyindex 873aff7c..a309cab6 100644--- a/tests/unittest/test_flash_pdf_samples.py+++ b/tests/unittest/test_flash_pdf_samples.py@@ -7,7 +7,7 @@ import unicodedatafrom mineru.backend.flash import pdf_extractor-from mineru.backend.flash.native_pdf import (+from mineru.model.flash.native_pdf import (formulas,geometry,graphics,diff --git a/tests/unittest/test_flash_pdf_tables.py b/tests/unittest/test_flash_pdf_tables.pyindex dbb914c1..8a964113 100644--- a/tests/unittest/test_flash_pdf_tables.py+++ b/tests/unittest/test_flash_pdf_tables.py@@ -4,7 +4,7 @@ from unittest.mock import MagicMockimport pytest-from mineru.backend.flash.native_pdf import (+from mineru.model.flash.native_pdf import (geometry,models,tables,diff --git a/tests/unittest/test_flash_pdf_text_blocks.py b/tests/unittest/test_flash_pdf_text_blocks.pyindex 8f3d69e3..b25cd8c0 100644--- a/tests/unittest/test_flash_pdf_text_blocks.py+++ b/tests/unittest/test_flash_pdf_text_blocks.py@@ -3,7 +3,7 @@ from __future__ import annotationsimport pytest-from mineru.backend.flash.native_pdf import (+from mineru.model.flash.native_pdf import (line_layout,line_merging,models,diff --git a/tests/unittest/test_flash_pdf_titles.py b/tests/unittest/test_flash_pdf_titles.pyindex e43a2713..e9ee329d 100644--- a/tests/unittest/test_flash_pdf_titles.py+++ b/tests/unittest/test_flash_pdf_titles.py@@ -4,7 +4,7 @@ import inspectimport pytest-from mineru.backend.flash.native_pdf import (+from mineru.model.flash.native_pdf import (line_layout,line_merging,text_blocks,diff --git a/tests/unittest/test_flash_pdf_visual_annotations.py b/tests/unittest/test_flash_pdf_visual_annotations.pyindex 66df5301..cf287eba 100644--- a/tests/unittest/test_flash_pdf_visual_annotations.py+++ b/tests/unittest/test_flash_pdf_visual_annotations.py@@ -2,7 +2,7 @@ from __future__ import annotationsimport pytest-from mineru.backend.flash.native_pdf import (+from mineru.model.flash.native_pdf import (geometry,pipeline,text_blocks,