repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
mitmproxy/mitmproxy | https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/platform/pf.py | mitmproxy/platform/pf.py | import re
import sys
def lookup(address, port, s):
"""
Parse the pfctl state output s, to look up the destination host
matching the client (address, port).
Returns an (address, port) tuple, or None.
"""
# We may get an ipv4-mapped ipv6 address here, e.g. ::ffff:127.0.0.1.
# Those still ap... | python | MIT | e6aa924bb411a9687b91920b8d094af37bc02b90 | 2026-01-04T14:40:00.086164Z | false |
mitmproxy/mitmproxy | https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/platform/linux.py | mitmproxy/platform/linux.py | import socket
import struct
# Python's socket module does not have these constants
SO_ORIGINAL_DST = 80
SOL_IPV6 = 41
def original_addr(csock: socket.socket) -> tuple[str, int]:
# Get the original destination on Linux.
# In theory, this can be done using the following syscalls:
# sock.getsockopt(sock... | python | MIT | e6aa924bb411a9687b91920b8d094af37bc02b90 | 2026-01-04T14:40:00.086164Z | false |
mitmproxy/mitmproxy | https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/platform/osx.py | mitmproxy/platform/osx.py | import subprocess
from . import pf
"""
Doing this the "right" way by using DIOCNATLOOK on the pf device turns out
to be a pain. Apple has made a number of modifications to the data
structures returned, and compiling userspace tools to test and work with
this turns out to be a pain in the ass. Parsing ... | python | MIT | e6aa924bb411a9687b91920b8d094af37bc02b90 | 2026-01-04T14:40:00.086164Z | false |
mitmproxy/mitmproxy | https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/platform/windows.py | mitmproxy/platform/windows.py | from __future__ import annotations
import collections.abc
import contextlib
import ctypes.wintypes
import json
import logging
import os
import re
import socket
import socketserver
import threading
import time
from collections.abc import Callable
from io import BufferedIOBase
from typing import Any
from typing import c... | python | MIT | e6aa924bb411a9687b91920b8d094af37bc02b90 | 2026-01-04T14:40:00.086164Z | false |
mitmproxy/mitmproxy | https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/platform/openbsd.py | mitmproxy/platform/openbsd.py | def original_addr(csock):
return csock.getsockname()
| python | MIT | e6aa924bb411a9687b91920b8d094af37bc02b90 | 2026-01-04T14:40:00.086164Z | false |
mitmproxy/mitmproxy | https://github.com/mitmproxy/mitmproxy/blob/e6aa924bb411a9687b91920b8d094af37bc02b90/mitmproxy/platform/__init__.py | mitmproxy/platform/__init__.py | import re
import socket
import sys
from collections.abc import Callable
def init_transparent_mode() -> None:
"""
Initialize transparent mode.
"""
original_addr: Callable[[socket.socket], tuple[str, int]] | None
"""
Get the original destination for the given socket.
This function will be None if transpar... | python | MIT | e6aa924bb411a9687b91920b8d094af37bc02b90 | 2026-01-04T14:40:00.086164Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_docling_json.py | tests/test_backend_docling_json.py | """Test methods in module docling.backend.json.docling_json_backend.py."""
from io import BytesIO
from pathlib import Path
import pytest
from pydantic import ValidationError
from docling.backend.json.docling_json_backend import DoclingJSONBackend
from docling.datamodel.base_models import InputFormat
from docling.dat... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_vtt.py | tests/test_backend_vtt.py | # Assisted by watsonx Code Assistant
from pathlib import Path
import pytest
from docling_core.types.doc import DoclingDocument
from pydantic import ValidationError
from docling.backend.webvtt_backend import (
_WebVTTCueItalicSpan,
_WebVTTCueTextSpan,
_WebVTTCueTimings,
_WebVTTCueVoiceSpan,
_WebVT... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_invalid_input.py | tests/test_invalid_input.py | from io import BytesIO
from pathlib import Path
import pytest
from docling.datamodel.base_models import ConversionStatus, DocumentStream
from docling.document_converter import ConversionError, DocumentConverter
def get_pdf_path():
pdf_path = Path("./tests/data/pdf/2305.03393v1-pg9.pdf")
return pdf_path
@p... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_asr_mlx_whisper.py | tests/test_asr_mlx_whisper.py | """
Test MLX Whisper integration for Apple Silicon ASR pipeline.
"""
import sys
from pathlib import Path
from unittest.mock import Mock, patch
import pytest
from docling.datamodel.accelerator_options import AcceleratorDevice, AcceleratorOptions
from docling.datamodel.asr_model_specs import (
WHISPER_BASE,
WH... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_docling_parse_v4.py | tests/test_backend_docling_parse_v4.py | from pathlib import Path
import pytest
from docling.backend.docling_parse_v4_backend import (
DoclingParseV4DocumentBackend,
DoclingParseV4PageBackend,
)
from docling.datamodel.base_models import BoundingBox, InputFormat
from docling.datamodel.document import InputDocument
@pytest.fixture
def test_doc_path(... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_msword.py | tests/test_backend_msword.py | import logging
import os
from pathlib import Path
import pytest
from docling_core.types.doc import GroupItem
from docling.backend.docx.drawingml.utils import get_libreoffice_cmd
from docling.backend.msword_backend import MsWordDocumentBackend
from docling.datamodel.base_models import InputFormat
from docling.datamode... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_markdown.py | tests/test_backend_markdown.py | from pathlib import Path
from docling.backend.md_backend import MarkdownDocumentBackend
from docling.datamodel.base_models import InputFormat
from docling.datamodel.document import (
ConversionResult,
DoclingDocument,
InputDocument,
)
from docling.document_converter import DocumentConverter
from tests.veri... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_extraction.py | tests/test_extraction.py | """
Test unit for document extraction functionality.
"""
import os
from pathlib import Path
import pytest
from pydantic import BaseModel, Field
from docling.datamodel.base_models import InputFormat
from docling.document_converter import DocumentConverter
from docling.document_extractor import DocumentExtractor
IS_C... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_pptx.py | tests/test_backend_pptx.py | from pathlib import Path
from docling.datamodel.base_models import InputFormat
from docling.datamodel.document import ConversionResult, DoclingDocument
from docling.document_converter import DocumentConverter
from .test_data_gen_flag import GEN_TEST_DATA
from .verify_utils import verify_document, verify_export
GENER... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_threaded_pipeline.py | tests/test_threaded_pipeline.py | import logging
import time
from pathlib import Path
from typing import List
import pytest
from docling.backend.pypdfium2_backend import PyPdfiumDocumentBackend
from docling.datamodel.base_models import ConversionStatus, InputFormat
from docling.datamodel.document import ConversionResult
from docling.datamodel.pipelin... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_document_picture_classifier.py | tests/test_document_picture_classifier.py | from pathlib import Path
from docling_core.types.doc import PictureClassificationData
from docling.datamodel.base_models import InputFormat
from docling.datamodel.document import ConversionResult
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling.document_converter import DocumentConverter... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_settings_load.py | tests/test_settings_load.py | import os
def _setup_env():
os.environ["DOCLING_PERF_PAGE_BATCH_SIZE"] = "12"
os.environ["DOCLING_DEBUG_VISUALIZE_RAW_LAYOUT"] = "True"
os.environ["DOCLING_ARTIFACTS_PATH"] = "/path/to/artifacts"
def test_settings():
_setup_env()
import importlib
import docling.datamodel.settings as m
... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_options.py | tests/test_options.py | import os
from pathlib import Path
import pytest
from docling.backend.docling_parse_backend import DoclingParseDocumentBackend
from docling.backend.docling_parse_v2_backend import DoclingParseV2DocumentBackend
from docling.backend.docling_parse_v4_backend import DoclingParseV4DocumentBackend
from docling.backend.pypd... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_image_native.py | tests/test_backend_image_native.py | from io import BytesIO
from pathlib import Path
import pytest
from docling_core.types.doc import BoundingBox, CoordOrigin
from PIL import Image
from docling.backend.image_backend import ImageDocumentBackend, _ImagePageBackend
from docling.datamodel.base_models import DocumentStream, InputFormat
from docling.datamodel... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_interfaces.py | tests/test_interfaces.py | from io import BytesIO
from pathlib import Path
from unittest.mock import Mock
import pytest
from docling.datamodel.accelerator_options import AcceleratorDevice
from docling.datamodel.base_models import DocumentStream, InputFormat
from docling.datamodel.pipeline_options_vlm_model import (
InferenceFramework,
... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_input_doc.py | tests/test_input_doc.py | from io import BytesIO
from pathlib import Path
import pytest
from pydantic import ValidationError
from docling.backend.html_backend import HTMLDocumentBackend
from docling.backend.pypdfium2_backend import PyPdfiumDocumentBackend
from docling.datamodel.backend_options import (
BaseBackendOptions,
DeclarativeB... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_cli.py | tests/test_cli.py | from pathlib import Path
from typer.testing import CliRunner
from docling.cli.main import app
runner = CliRunner()
def test_cli_help():
result = runner.invoke(app, ["--help"])
assert result.exit_code == 0
def test_cli_version():
result = runner.invoke(app, ["--version"])
assert result.exit_code =... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_pdfium.py | tests/test_backend_pdfium.py | from pathlib import Path
import pytest
from docling_core.types.doc import BoundingBox
from docling.backend.pypdfium2_backend import (
PyPdfiumDocumentBackend,
PyPdfiumPageBackend,
)
from docling.datamodel.base_models import InputFormat
from docling.datamodel.document import InputDocument
from docling.datamode... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_patent_uspto.py | tests/test_backend_patent_uspto.py | """Test methods in module docling.backend.patent_uspto_backend.py."""
import logging
import os
from pathlib import Path
from tempfile import NamedTemporaryFile
import pytest
from docling_core.types import DoclingDocument
from docling_core.types.doc import DocItemLabel, TableData, TextItem
from docling.backend.xml.us... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_ocr_utils.py | tests/test_ocr_utils.py | from typing import Tuple
import pytest
from docling_core.types.doc import BoundingBox, CoordOrigin
from docling_core.types.doc.page import BoundingRectangle
from docling.utils.orientation import rotate_bounding_box
IM_SIZE = (4, 5)
BBOX = BoundingBox(l=1, t=3, r=3, b=4, coord_origin=CoordOrigin.TOPLEFT)
RECT = Bound... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_legacy_format_transform.py | tests/test_legacy_format_transform.py | import json
from pathlib import Path
import pytest
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling.document_converter import DocumentConverter, PdfFormatOption
@pytest.fixture
def test_doc_paths():
return [
Path("tests/... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_docling_parse.py | tests/test_backend_docling_parse.py | from pathlib import Path
import pytest
from docling_core.types.doc import BoundingBox
from docling.backend.docling_parse_backend import (
DoclingParseDocumentBackend,
DoclingParsePageBackend,
)
from docling.datamodel.base_models import InputFormat
from docling.datamodel.document import InputDocument
@pytest... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_conversion_result_json.py | tests/test_conversion_result_json.py | from io import BytesIO
from pathlib import Path
import pytest
from docling.backend.pypdfium2_backend import (
PyPdfiumDocumentBackend,
PyPdfiumPageBackend,
)
from docling.datamodel.base_models import ConversionStatus, InputFormat
from docling.datamodel.document import ConversionAssets
from docling.datamodel.p... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/__init__.py | tests/__init__.py | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false | |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_jats.py | tests/test_backend_jats.py | import os
from io import BytesIO
from pathlib import Path
from docling_core.types.doc import DoclingDocument
from docling.datamodel.base_models import DocumentStream, InputFormat
from docling.datamodel.document import ConversionResult
from docling.document_converter import DocumentConverter
from .test_data_gen_flag ... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_e2e_conversion.py | tests/test_e2e_conversion.py | from pathlib import Path
from docling.datamodel.accelerator_options import AcceleratorDevice
from docling.datamodel.base_models import InputFormat
from docling.datamodel.document import ConversionResult
from docling.datamodel.pipeline_options import PdfPipelineOptions
from docling.document_converter import DocumentCon... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_code_formula.py | tests/test_code_formula.py | from pathlib import Path
from docling_core.types.doc import CodeItem, TextItem
from docling_core.types.doc.labels import CodeLanguageLabel, DocItemLabel
from docling.datamodel.base_models import InputFormat
from docling.datamodel.document import ConversionResult
from docling.datamodel.pipeline_options import PdfPipel... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_asr_pipeline.py | tests/test_asr_pipeline.py | import sys
from pathlib import Path
from unittest.mock import Mock, patch
import pytest
from docling.datamodel import asr_model_specs
from docling.datamodel.base_models import ConversionStatus, InputFormat
from docling.datamodel.document import ConversionResult, InputDocument
from docling.datamodel.pipeline_options i... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_e2e_ocr_conversion.py | tests/test_e2e_ocr_conversion.py | import sys
from pathlib import Path
from typing import List, Tuple
from docling.backend.docling_parse_backend import DoclingParseDocumentBackend
from docling.backend.docling_parse_v2_backend import DoclingParseV2DocumentBackend
from docling.backend.docling_parse_v4_backend import DoclingParseV4DocumentBackend
from doc... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_data_gen_flag.py | tests/test_data_gen_flag.py | import os
from pydantic import TypeAdapter
GEN_TEST_DATA = TypeAdapter(bool).validate_python(os.getenv("DOCLING_GEN_TEST_DATA", 0))
def test_gen_test_data_flag():
assert not GEN_TEST_DATA
| python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_mets_gbs.py | tests/test_backend_mets_gbs.py | from pathlib import Path
import pytest
from docling.backend.mets_gbs_backend import MetsGbsDocumentBackend, MetsGbsPageBackend
from docling.datamodel.base_models import BoundingBox, InputFormat
from docling.datamodel.document import InputDocument
@pytest.fixture
def test_doc_path():
return Path("tests/data/mets... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_docling_parse_v2.py | tests/test_backend_docling_parse_v2.py | from pathlib import Path
import pytest
from docling.backend.docling_parse_v2_backend import (
DoclingParseV2DocumentBackend,
DoclingParseV2PageBackend,
)
from docling.datamodel.base_models import BoundingBox, InputFormat
from docling.datamodel.document import InputDocument
@pytest.fixture
def test_doc_path(... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_csv.py | tests/test_backend_csv.py | from pathlib import Path
from pytest import warns
from docling.datamodel.base_models import InputFormat
from docling.datamodel.document import ConversionResult, DoclingDocument
from docling.document_converter import DocumentConverter
from .test_data_gen_flag import GEN_TEST_DATA
from .verify_utils import verify_docu... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_asciidoc.py | tests/test_backend_asciidoc.py | import glob
import os
from pathlib import Path
from docling.backend.asciidoc_backend import (
DEFAULT_IMAGE_HEIGHT,
DEFAULT_IMAGE_WIDTH,
AsciiDocBackend,
)
from docling.datamodel.base_models import InputFormat
from docling.datamodel.document import InputDocument
def _get_backend(fname):
in_doc = Inpu... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_html.py | tests/test_backend_html.py | from io import BytesIO
from pathlib import Path, PurePath
from unittest.mock import Mock, mock_open, patch
import pytest
from bs4 import BeautifulSoup
from docling_core.types.doc import PictureItem
from docling_core.types.doc.document import ContentLayer
from pydantic import AnyUrl, ValidationError
from docling.backe... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_pdf_password.py | tests/test_pdf_password.py | from dataclasses import dataclass
from pathlib import Path
from typing import Iterable
import pytest
from docling.backend.docling_parse_v4_backend import DoclingParseV4DocumentBackend
from docling.backend.pypdfium2_backend import (
PyPdfiumDocumentBackend,
)
from docling.datamodel.backend_options import PdfBacken... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_msexcel.py | tests/test_backend_msexcel.py | import logging
from io import BytesIO
from pathlib import Path
import pytest
from openpyxl import load_workbook
from docling.backend.msexcel_backend import MsExcelDocumentBackend
from docling.datamodel.backend_options import MsExcelBackendOptions
from docling.datamodel.base_models import InputFormat
from docling.data... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/test_backend_webp.py | tests/test_backend_webp.py | import sys
from pathlib import Path
from typing import List
from pydantic.type_adapter import R
from docling.datamodel.base_models import InputFormat
from docling.datamodel.document import ConversionResult, DoclingDocument
from docling.datamodel.pipeline_options import (
EasyOcrOptions,
OcrMacOptions,
Ocr... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/tests/verify_utils.py | tests/verify_utils.py | import json
import os
from pathlib import Path
from typing import Optional
import pytest
from docling_core.types.doc import (
CodeItem,
DocItem,
DoclingDocument,
FormulaItem,
PictureItem,
TableItem,
TextItem,
)
from docling_core.types.legacy_doc.document import ExportedCCSDocument as DsDocu... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/vlm_pipeline_api_model.py | docs/examples/vlm_pipeline_api_model.py | # %% [markdown]
# Use the VLM pipeline with remote API models (LM Studio, Ollama, watsonx.ai).
#
# What this example does
# - Shows how to configure `ApiVlmOptions` for different VLM providers.
# - Converts a single PDF page using the VLM pipeline and prints Markdown.
#
# Prerequisites
# - Install Docling with VLM extr... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/pictures_description_api.py | docs/examples/pictures_description_api.py | # %% [markdown]
# Describe pictures using a remote VLM API (vLLM, LM Studio, or watsonx.ai).
#
# What this example does
# - Configures `PictureDescriptionApiOptions` for local or cloud providers.
# - Converts a PDF, then prints each picture's caption and annotations.
#
# Prerequisites
# - Install Docling and `python-do... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/run_md.py | docs/examples/run_md.py | import json
import logging
import os
from pathlib import Path
import yaml
from docling.backend.md_backend import MarkdownDocumentBackend
from docling.datamodel.base_models import InputFormat
from docling.datamodel.document import InputDocument
_log = logging.getLogger(__name__)
def main():
input_paths = [Path(... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/enrich_simple_pipeline.py | docs/examples/enrich_simple_pipeline.py | import logging
from pathlib import Path
from docling.datamodel.base_models import InputFormat
from docling.datamodel.pipeline_options import ConvertPipelineOptions
from docling.document_converter import (
DocumentConverter,
HTMLFormatOption,
WordFormatOption,
)
_log = logging.getLogger(__name__)
def mai... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/run_with_accelerator.py | docs/examples/run_with_accelerator.py | # %% [markdown]
# Run conversion with an explicit accelerator configuration (CPU/MPS/CUDA).
#
# What this example does
# - Shows how to select the accelerator device and thread count.
# - Enables OCR and table structure to exercise compute paths, and prints timings.
#
# How to run
# - From the repo root: `python docs/e... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/develop_picture_enrichment.py | docs/examples/develop_picture_enrichment.py | # %% [markdown]
# Developing a picture enrichment model (classifier scaffold only).
#
# What this example does
# - Demonstrates how to implement an enrichment model that annotates pictures.
# - Adds a dummy PictureClassificationData entry to each PictureItem.
#
# Important
# - This is a scaffold for development; it doe... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/develop_formula_understanding.py | docs/examples/develop_formula_understanding.py | # %% [markdown]
# Developing an enrichment model example (formula understanding: scaffold only).
#
# What this example does
# - Shows how to define pipeline options, an enrichment model, and extend a pipeline.
# - Displays cropped images of formula items and yields them back unchanged.
#
# Important
# - This is a devel... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/translate.py | docs/examples/translate.py | # %% [markdown]
# Translate extracted text content and regenerate Markdown with embedded images.
#
# What this example does
# - Converts a PDF and saves original Markdown with embedded images.
# - Translates text elements and table cell contents, then saves a translated Markdown.
#
# Prerequisites
# - Install Docling. ... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/parquet_images.py | docs/examples/parquet_images.py | # %% [markdown]
# What this example does
# - Run a batch conversion on a parquet file with an image column.
#
# Requirements
# - Python 3.9+
# - Install Docling: `pip install docling`
#
# How to run
# - `python docs/examples/parquet_images.py FILE`
#
# The parquet file should be in the format similar to the ViDoRe V3 d... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/compare_vlm_models.py | docs/examples/compare_vlm_models.py | # %% [markdown]
# Compare different VLM models by running the VLM pipeline and timing outputs.
#
# What this example does
# - Iterates through a list of VLM model configurations and converts the same file.
# - Prints per-page generation times and saves JSON/MD/HTML to `scratch/`.
# - Summarizes total inference time and... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/tesseract_lang_detection.py | docs/examples/tesseract_lang_detection.py | # %% [markdown]
# Detect language automatically with Tesseract OCR and force full-page OCR.
#
# What this example does
# - Configures Tesseract (CLI in this snippet) with `lang=["auto"]`.
# - Forces full-page OCR and prints the recognized text as Markdown.
#
# How to run
# - From the repo root: `python docs/examples/te... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/run_with_formats.py | docs/examples/run_with_formats.py | # %% [markdown]
# Run conversion across multiple input formats and customize handling per type.
#
# What this example does
# - Demonstrates converting a mixed list of files (PDF, DOCX, PPTX, HTML, images, etc.).
# - Shows how to restrict `allowed_formats` and override `format_options` per format.
# - Writes results (Ma... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/mlx_whisper_example.py | docs/examples/mlx_whisper_example.py | #!/usr/bin/env python3
"""
Example script demonstrating MLX Whisper integration for Apple Silicon.
This script shows how to use the MLX Whisper models for speech recognition
on Apple Silicon devices with optimized performance.
"""
import argparse
import sys
from pathlib import Path
# Add the repository root to the p... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/post_process_ocr_with_vlm.py | docs/examples/post_process_ocr_with_vlm.py | import argparse
import logging
import os
import re
from collections.abc import Iterable
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from typing import Any, Optional, Union
import numpy as np
from docling_core.types.doc import (
DoclingDocument,
ImageRefMode,
NodeItem,
Tex... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/gpu_standard_pipeline.py | docs/examples/gpu_standard_pipeline.py | # %% [markdown]
#
# What this example does
# - Run a conversion using the best setup for GPU for the standard pipeline
#
# Requirements
# - Python 3.9+
# - Install Docling: `pip install docling`
#
# How to run
# - `python docs/examples/gpu_standard_pipeline.py`
#
# This example is part of a set of GPU optimization stra... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/export_tables.py | docs/examples/export_tables.py | # %% [markdown]
# Extract tables from a PDF and export them as CSV and HTML.
#
# What this example does
# - Converts a PDF and iterates detected tables.
# - Prints each table as Markdown to stdout, and saves CSV/HTML to `scratch/`.
#
# Prerequisites
# - Install Docling and `pandas`.
#
# How to run
# - From the repo roo... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/granitedocling_repetition_stopping.py | docs/examples/granitedocling_repetition_stopping.py | # %% [markdown]
# Experimental VLM pipeline with custom repetition stopping criteria.
#
# This script demonstrates the use of custom stopping criteria that detect
# repetitive location coordinate patterns in generated text and stop generation
# when such patterns are found.
#
# What this example does
# - Uses the Grani... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/asr_pipeline_performance_comparison.py | docs/examples/asr_pipeline_performance_comparison.py | #!/usr/bin/env python3
"""
Performance comparison between CPU and MLX Whisper on Apple Silicon.
This script compares the performance of:
1. Native Whisper (forced to CPU)
2. MLX Whisper (Apple Silicon optimized)
Both use the same model size for fair comparison.
"""
import argparse
import sys
import time
from pathlib... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/demo_layout_vlm.py | docs/examples/demo_layout_vlm.py | #!/usr/bin/env python3
"""Demo script for the new ThreadedLayoutVlmPipeline.
This script demonstrates the usage of the experimental ThreadedLayoutVlmPipeline pipeline
that combines layout model preprocessing with VLM processing in a threaded manner.
"""
import argparse
import logging
import traceback
from pathlib imp... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/pii_obfuscate.py | docs/examples/pii_obfuscate.py | # %% [markdown]
# Detect and obfuscate PII using a Hugging Face NER model.
#
# What this example does
# - Converts a PDF and saves original Markdown with embedded images.
# - Runs a HF token-classification pipeline (NER) to detect PII-like entities.
# - Obfuscates occurrences in TextItem and TableItem by stable, type-b... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/minimal_vlm_pipeline.py | docs/examples/minimal_vlm_pipeline.py | # %% [markdown]
# Minimal VLM pipeline example: convert a PDF using a vision-language model.
#
# What this example does
# - Runs the VLM-powered pipeline on a PDF (by URL) and prints Markdown output.
# - Shows two setups: default (Transformers/GraniteDocling) and macOS MPS/MLX.
#
# Prerequisites
# - Install Docling wit... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/batch_convert.py | docs/examples/batch_convert.py | # %% [markdown]
# Batch convert multiple PDF files and export results in several formats.
# What this example does
# - Loads a small set of sample PDFs.
# - Runs the Docling PDF pipeline once per file.
# - Writes outputs to `scratch/` in multiple formats (JSON, HTML, Markdown, text, doctags, YAML).
# Prerequisites
# ... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/export_figures.py | docs/examples/export_figures.py | # %% [markdown]
# Export page, figure, and table images from a PDF and save rich outputs.
#
# What this example does
# - Converts a PDF, keeps page/element images, and writes them to `scratch/`.
# - Exports Markdown and HTML with either embedded or referenced images.
#
# Prerequisites
# - Install Docling and image depe... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/gpu_vlm_pipeline.py | docs/examples/gpu_vlm_pipeline.py | # %% [markdown]
#
# What this example does
# - Run a conversion using the best setup for GPU using VLM models
#
# Requirements
# - Python 3.10+
# - Install Docling: `pip install docling`
# - Install vLLM: `pip install vllm`
#
# How to run
# - `python docs/examples/gpu_vlm_pipeline.py`
#
# This example is part of a set ... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/suryaocr_with_custom_models.py | docs/examples/suryaocr_with_custom_models.py | # Example: Integrating SuryaOCR with Docling for PDF OCR and Markdown Export
#
# Overview:
# - Configures SuryaOCR options for OCR.
# - Executes PDF pipeline with SuryaOCR integration.
# - Models auto-download from Hugging Face on first run.
#
# Prerequisites:
# - Install: `pip install docling-surya`
# - Ensure `doclin... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/minimal.py | docs/examples/minimal.py | # %% [markdown]
# What this example does
# - Converts a single source (URL or local file path) to a unified Docling
# document and prints Markdown to stdout.
#
# Requirements
# - Python 3.9+
# - Install Docling: `pip install docling`
#
# How to run
# - Use the default sample URL: `python docs/examples/minimal.py`
# -... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/inspect_picture_content.py | docs/examples/inspect_picture_content.py | # %% [markdown]
# Inspect the contents associated with each picture in a converted document.
#
# What this example does
# - Converts a PDF and iterates over each PictureItem.
# - Prints the caption and the textual items contained within the picture region.
#
# How to run
# - From the repo root: `python docs/examples/in... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/enrich_doclingdocument.py | docs/examples/enrich_doclingdocument.py | # %% [markdown]
# Enrich an existing DoclingDocument JSON with a custom model (post-conversion).
#
# What this example does
# - Loads a previously converted DoclingDocument from JSON (no reconversion).
# - Uses a backend to crop images for items and runs an enrichment model in batches.
# - Prints a few example annotati... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/rapidocr_with_custom_models.py | docs/examples/rapidocr_with_custom_models.py | # %% [markdown]
# Use RapidOCR with custom ONNX models to OCR a PDF page and print Markdown.
#
# What this example does
# - Downloads RapidOCR models from Hugging Face via ModelScope.
# - Configures `RapidOcrOptions` with explicit det/rec/cls model paths.
# - Runs the PDF pipeline with RapidOCR and prints Markdown outp... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/custom_convert.py | docs/examples/custom_convert.py | # %% [markdown]
# Customize PDF conversion by toggling OCR/backends and pipeline options.
#
# What this example does
# - Shows several alternative configurations for the Docling PDF pipeline.
# - Lets you try OCR engines (EasyOCR, Tesseract, system OCR) or no OCR.
# - Converts a single sample PDF and exports results to... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/export_multimodal.py | docs/examples/export_multimodal.py | # %% [markdown]
# Export multimodal page data (image bytes, text, segments) to a Parquet file.
#
# What this example does
# - Converts a PDF and assembles per-page multimodal records: image, cells, text, segments.
# - Normalizes records to a pandas DataFrame and writes a timestamped `.parquet` in `scratch/`.
#
# Prereq... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/full_page_ocr.py | docs/examples/full_page_ocr.py | # %% [markdown]
# Force full-page OCR on a PDF using different OCR backends.
#
# What this example does
# - Enables full-page OCR and table structure extraction for a sample PDF.
# - Demonstrates how to switch between OCR backends via `ocr_options`.
#
# Prerequisites
# - Install Docling and the desired OCR backend's de... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/minimal_asr_pipeline.py | docs/examples/minimal_asr_pipeline.py | # %% [markdown]
# Minimal ASR pipeline example: transcribe an audio file to Markdown text.
#
# What this example does
# - Configures the ASR pipeline with a default model spec and converts one audio file.
# - Prints the recognized speech segments in Markdown with timestamps.
#
# Prerequisites
# - Install Docling with A... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docs/examples/experimental/process_table_crops.py | docs/examples/experimental/process_table_crops.py | """Run Docling on an image using the experimental TableCrops layout model."""
from __future__ import annotations
from pathlib import Path
import docling
from docling.datamodel.document import InputFormat
from docling.datamodel.pipeline_options import ThreadedPdfPipelineOptions
from docling.document_converter import ... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/exceptions.py | docling/exceptions.py | class BaseError(RuntimeError):
pass
class ConversionError(BaseError):
pass
class OperationNotAllowed(BaseError):
pass
| python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/document_extractor.py | docling/document_extractor.py | import hashlib
import logging
import sys
import threading
import time
import warnings
from collections.abc import Iterable, Iterator
from concurrent.futures import ThreadPoolExecutor
from functools import partial
from pathlib import Path
from typing import Optional, Type, Union
from pydantic import ConfigDict, model_v... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/__init__.py | docling/__init__.py | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false | |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/document_converter.py | docling/document_converter.py | import hashlib
import logging
import sys
import threading
import time
import warnings
from collections.abc import Iterable, Iterator
from concurrent.futures import ThreadPoolExecutor
from datetime import datetime
from functools import partial
from io import BytesIO
from pathlib import Path
from typing import Optional, ... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/datamodel/accelerator_options.py | docling/datamodel/accelerator_options.py | import logging
import os
import re
from enum import Enum
from typing import Any, Union
from pydantic import field_validator, model_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
_log = logging.getLogger(__name__)
class AcceleratorDevice(str, Enum):
"""Devices to run model inference"""
... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/datamodel/extraction.py | docling/datamodel/extraction.py | """Data models for document extraction functionality."""
from typing import Any, Dict, List, Optional, Type, Union
from pydantic import BaseModel, Field
from docling.datamodel.base_models import ConversionStatus, ErrorItem, VlmStopReason
from docling.datamodel.document import InputDocument
class ExtractedPageData(... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/datamodel/document.py | docling/datamodel/document.py | import csv
import importlib
import json
import logging
import platform
import re
import sys
import tarfile
import zipfile
from collections.abc import Iterable, Mapping
from datetime import datetime
from enum import Enum
from io import BytesIO
from pathlib import Path, PurePath
from typing import (
TYPE_CHECKING,
... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/datamodel/vlm_model_specs.py | docling/datamodel/vlm_model_specs.py | import logging
from enum import Enum
from pydantic import (
AnyUrl,
)
from docling.datamodel.accelerator_options import AcceleratorDevice
from docling.datamodel.pipeline_options_vlm_model import (
ApiVlmOptions,
InferenceFramework,
InlineVlmOptions,
ResponseFormat,
TransformersModelType,
T... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/datamodel/settings.py | docling/datamodel/settings.py | import sys
from pathlib import Path
from typing import Annotated, Optional, Tuple
from pydantic import BaseModel, PlainValidator
from pydantic_settings import BaseSettings, SettingsConfigDict
def _validate_page_range(v: Tuple[int, int]) -> Tuple[int, int]:
if v[0] < 1 or v[1] < v[0]:
raise ValueError(
... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/datamodel/base_models.py | docling/datamodel/base_models.py | from collections import defaultdict
from enum import Enum
from typing import TYPE_CHECKING, Optional, Type, Union
import numpy as np
from docling_core.types.doc import (
BoundingBox,
DocItemLabel,
NodeItem,
PictureDataType,
Size,
TableCell,
)
from docling_core.types.doc.base import PydanticSerC... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/datamodel/__init__.py | docling/datamodel/__init__.py | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false | |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/datamodel/layout_model_specs.py | docling/datamodel/layout_model_specs.py | import logging
from enum import Enum
from pathlib import Path
from typing import Optional
from pydantic import BaseModel
from docling.datamodel.accelerator_options import AcceleratorDevice
_log = logging.getLogger(__name__)
class LayoutModelConfig(BaseModel):
name: str
repo_id: str
revision: str
mo... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/datamodel/pipeline_options_vlm_model.py | docling/datamodel/pipeline_options_vlm_model.py | from enum import Enum
from typing import TYPE_CHECKING, Any, Dict, List, Literal, Optional, Union
from docling_core.types.doc.page import SegmentedPage
from pydantic import AnyUrl, BaseModel, ConfigDict
from transformers import StoppingCriteria
from typing_extensions import deprecated
from docling.datamodel.accelerat... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/datamodel/pipeline_options_asr_model.py | docling/datamodel/pipeline_options_asr_model.py | from enum import Enum
from typing import Any, Dict, List, Literal, Optional, Union
from pydantic import AnyUrl, BaseModel
from typing_extensions import deprecated
from docling.datamodel.accelerator_options import AcceleratorDevice
from docling.datamodel.pipeline_options_vlm_model import (
# InferenceFramework,
... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/datamodel/backend_options.py | docling/datamodel/backend_options.py | from pathlib import PurePath
from typing import Annotated, Literal, Optional, Union
from pydantic import AnyUrl, BaseModel, Field, SecretStr
class BaseBackendOptions(BaseModel):
"""Common options for all declarative document backends."""
enable_remote_fetch: bool = Field(
False, description="Enable ... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/datamodel/pipeline_options.py | docling/datamodel/pipeline_options.py | import logging
from datetime import datetime
from enum import Enum
from pathlib import Path
from typing import Annotated, Any, ClassVar, Dict, List, Literal, Optional, Union
from pydantic import (
AnyUrl,
BaseModel,
ConfigDict,
Field,
)
from typing_extensions import deprecated
from docling.datamodel i... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/datamodel/asr_model_specs.py | docling/datamodel/asr_model_specs.py | import logging
from enum import Enum
from pydantic import (
AnyUrl,
)
from docling.datamodel.accelerator_options import AcceleratorDevice
from docling.datamodel.pipeline_options_asr_model import (
# AsrResponseFormat,
# ApiAsrOptions,
InferenceAsrFramework,
InlineAsrMlxWhisperOptions,
InlineAs... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/models/base_model.py | docling/models/base_model.py | import logging
from abc import ABC, abstractmethod
from collections.abc import Iterable
from typing import Any, Generic, Optional, Protocol, Type, Union
import numpy as np
from docling_core.types.doc import (
BoundingBox,
DocItem,
DoclingDocument,
NodeItem,
PictureItem,
)
from PIL.Image import Imag... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/models/table_structure_model.py | docling/models/table_structure_model.py | import copy
import warnings
from collections.abc import Iterable, Sequence
from pathlib import Path
from typing import Optional
import numpy
from docling_core.types.doc import BoundingBox, DocItemLabel, TableCell
from docling_core.types.doc.page import (
BoundingRectangle,
TextCellUnit,
)
from PIL import Image... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/models/document_picture_classifier.py | docling/models/document_picture_classifier.py | from collections.abc import Iterable
from pathlib import Path
from typing import List, Literal, Optional, Union
import numpy as np
from docling_core.types.doc import (
DoclingDocument,
NodeItem,
PictureClassificationClass,
PictureClassificationData,
PictureItem,
)
from PIL import Image
from pydanti... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
docling-project/docling | https://github.com/docling-project/docling/blob/7a4593f41f14ffce3871b11a92fdd56d391ffcd0/docling/models/picture_description_api_model.py | docling/models/picture_description_api_model.py | from collections.abc import Iterable
from concurrent.futures import ThreadPoolExecutor
from pathlib import Path
from typing import Optional, Type, Union
from PIL import Image
from docling.datamodel.accelerator_options import AcceleratorOptions
from docling.datamodel.pipeline_options import (
PictureDescriptionApi... | python | MIT | 7a4593f41f14ffce3871b11a92fdd56d391ffcd0 | 2026-01-04T14:39:31.148558Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.