sample_id stringlengths 21 196 | text stringlengths 105 936k | metadata dict | category stringclasses 6
values |
|---|---|---|---|
django/django:tests/resolve_url/views.py | from django.http import HttpResponse
from django.views import View
def some_view(request):
return HttpResponse("ok")
def params_view(request, slug):
return HttpResponse(f"Params: {slug}")
class SomeView(View):
def get(self, request):
return HttpResponse("ok")
class ParamsView(View):
def ... | {
"repo_id": "django/django",
"file_path": "tests/resolve_url/views.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 14,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
django/django:tests/urlpatterns/lazy_path_urls.py | from django.urls import include, path
from django.utils.translation import gettext_lazy as _
from . import views
urlpatterns = [
path(_("included_urls/"), include("urlpatterns.included_urls")),
path(_("lazy/<slug:slug>/"), views.empty_view, name="lazy"),
]
| {
"repo_id": "django/django",
"file_path": "tests/urlpatterns/lazy_path_urls.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 7,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
django/django:django/db/models/functions/uuid.py | from django.db import NotSupportedError
from django.db.models.expressions import Func
from django.db.models.fields import UUIDField
class UUID4(Func):
function = "UUIDV4"
arity = 0
output_field = UUIDField()
def as_sql(self, compiler, connection, **extra_context):
if connection.features.suppo... | {
"repo_id": "django/django",
"file_path": "django/db/models/functions/uuid.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 69,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
django/django:tests/db_functions/test_uuid.py | import uuid
from datetime import datetime, timedelta, timezone
from django.db import NotSupportedError, connection
from django.db.models.functions import UUID4, UUID7
from django.test import TestCase
from django.test.testcases import skipIfDBFeature, skipUnlessDBFeature
from .models import UUIDModel
class TestUUID(... | {
"repo_id": "django/django",
"file_path": "tests/db_functions/test_uuid.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 78,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
django/django:scripts/archive_eol_stable_branches.py | #! /usr/bin/env python3
import argparse
import os
import subprocess
import sys
def run(cmd, *, cwd=None, env=None, dry_run=True):
"""Run a command with optional dry-run behavior."""
environ = os.environ.copy()
if env:
environ.update(env)
if dry_run:
print("[DRY RUN]", " ".join(cmd))
... | {
"repo_id": "django/django",
"file_path": "scripts/archive_eol_stable_branches.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 127,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
django/django:scripts/do_django_release.py | #! /usr/bin/env python
"""Helper to build and publish Django artifacts.
Original author: Tim Graham.
Other authors: Mariusz Felisiak, Natalia Bidart.
"""
import hashlib
import os
import re
import subprocess
from datetime import date
PGP_KEY_ID = os.getenv("PGP_KEY_ID")
PGP_KEY_URL = os.getenv("PGP_KEY_URL")
PGP_EM... | {
"repo_id": "django/django",
"file_path": "scripts/do_django_release.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 175,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
django/django:django/conf/locale/ht/formats.py | # This file is distributed under the same license as the Django package.
#
# The *_FORMAT strings use the Django date format syntax,
# see https://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = "N j, Y"
TIME_FORMAT = "P"
DATETIME_FORMAT = "N j, Y, P"
YEAR_MONTH_FORMAT = "F Y"
MONTH_DAY_FORMAT ... | {
"repo_id": "django/django",
"file_path": "django/conf/locale/ht/formats.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 46,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
django/django:django/tasks/backends/base.py | from abc import ABCMeta, abstractmethod
from inspect import iscoroutinefunction
from asgiref.sync import sync_to_async
from django.conf import settings
from django.tasks import DEFAULT_TASK_QUEUE_NAME
from django.tasks.base import (
DEFAULT_TASK_PRIORITY,
TASK_MAX_PRIORITY,
TASK_MIN_PRIORITY,
Task,
)
... | {
"repo_id": "django/django",
"file_path": "django/tasks/backends/base.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 90,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
django/django:django/tasks/backends/dummy.py | from copy import deepcopy
from django.tasks.base import TaskResult, TaskResultStatus
from django.tasks.exceptions import TaskResultDoesNotExist
from django.tasks.signals import task_enqueued
from django.utils import timezone
from django.utils.crypto import get_random_string
from .base import BaseTaskBackend
class D... | {
"repo_id": "django/django",
"file_path": "django/tasks/backends/dummy.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 51,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
django/django:django/tasks/backends/immediate.py | import logging
from traceback import format_exception
from django.tasks.base import TaskContext, TaskError, TaskResult, TaskResultStatus
from django.tasks.signals import task_enqueued, task_finished, task_started
from django.utils import timezone
from django.utils.crypto import get_random_string
from django.utils.json... | {
"repo_id": "django/django",
"file_path": "django/tasks/backends/immediate.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 81,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
django/django:django/tasks/base.py | from collections.abc import Callable
from dataclasses import dataclass, field, replace
from datetime import datetime
from inspect import isclass, iscoroutinefunction
from typing import Any
from asgiref.sync import async_to_sync, sync_to_async
from django.db.models.enums import TextChoices
from django.utils.json impor... | {
"repo_id": "django/django",
"file_path": "django/tasks/base.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 200,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
django/django:django/tasks/checks.py | from django.core import checks
@checks.register
def check_tasks(app_configs=None, **kwargs):
"""Checks all registered Task backends."""
from . import task_backends
for backend in task_backends.all():
yield from backend.check()
| {
"repo_id": "django/django",
"file_path": "django/tasks/checks.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 7,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
django/django:django/tasks/exceptions.py | from django.core.exceptions import ImproperlyConfigured
class TaskException(Exception):
"""Base class for task-related exceptions. Do not raise directly."""
class InvalidTask(TaskException):
"""The provided Task is invalid."""
class InvalidTaskBackend(ImproperlyConfigured):
"""The provided Task backen... | {
"repo_id": "django/django",
"file_path": "django/tasks/exceptions.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 11,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | documentation |
django/django:django/tasks/signals.py | import logging
import sys
from asgiref.local import Local
from django.core.signals import setting_changed
from django.dispatch import Signal, receiver
from .base import TaskResultStatus
logger = logging.getLogger("django.tasks")
task_enqueued = Signal()
task_finished = Signal()
task_started = Signal()
@receiver(... | {
"repo_id": "django/django",
"file_path": "django/tasks/signals.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 51,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
django/django:django/utils/json.py | from collections.abc import Mapping, Sequence
def normalize_json(obj):
"""Recursively normalize an object into JSON-compatible types."""
match obj:
case Mapping():
return {normalize_json(k): normalize_json(v) for k, v in obj.items()}
case bytes():
try:
r... | {
"repo_id": "django/django",
"file_path": "django/utils/json.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 17,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
django/django:tests/tasks/tasks.py | import time
from django.tasks import TaskContext, task
@task()
def noop_task(*args, **kwargs):
return None
@task
def noop_task_from_bare_decorator(*args, **kwargs):
return None
@task()
async def noop_task_async(*args, **kwargs):
return None
@task()
def calculate_meaning_of_life():
return 42
@... | {
"repo_id": "django/django",
"file_path": "tests/tasks/tasks.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 49,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
django/django:tests/tasks/test_custom_backend.py | import logging
from unittest import mock
from django.tasks import default_task_backend, task_backends
from django.tasks.backends.base import BaseTaskBackend
from django.tasks.exceptions import InvalidTask
from django.test import SimpleTestCase, override_settings
from . import tasks as test_tasks
class CustomBackend... | {
"repo_id": "django/django",
"file_path": "tests/tasks/test_custom_backend.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 57,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
django/django:tests/tasks/test_dummy_backend.py | from typing import cast
from unittest import mock
from django.db import transaction
from django.tasks import TaskResultStatus, default_task_backend, task_backends
from django.tasks.backends.dummy import DummyBackend
from django.tasks.base import Task
from django.tasks.exceptions import InvalidTask, TaskResultDoesNotEx... | {
"repo_id": "django/django",
"file_path": "tests/tasks/test_dummy_backend.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 162,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
django/django:tests/tasks/test_immediate_backend.py | from django.db import transaction
from django.tasks import TaskResultStatus, default_task_backend, task_backends
from django.tasks.backends.immediate import ImmediateBackend
from django.tasks.exceptions import InvalidTask
from django.test import SimpleTestCase, TransactionTestCase, override_settings
from django.utils i... | {
"repo_id": "django/django",
"file_path": "tests/tasks/test_immediate_backend.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 253,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
django/django:tests/tasks/test_tasks.py | import dataclasses
from datetime import datetime
from django.tasks import (
DEFAULT_TASK_QUEUE_NAME,
TaskResultStatus,
default_task_backend,
task,
task_backends,
)
from django.tasks.backends.dummy import DummyBackend
from django.tasks.backends.immediate import ImmediateBackend
from django.tasks.bas... | {
"repo_id": "django/django",
"file_path": "tests/tasks/test_tasks.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 244,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
django/django:tests/utils_tests/test_json.py | import json
from collections import UserList, defaultdict
from datetime import datetime
from decimal import Decimal
from django.test import SimpleTestCase
from django.utils.json import normalize_json
class JSONNormalizeTestCase(SimpleTestCase):
def test_converts_json_types(self):
for test_case, expected ... | {
"repo_id": "django/django",
"file_path": "tests/utils_tests/test_json.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 41,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
django/django:django/views/decorators/csp.py | from functools import wraps
from inspect import iscoroutinefunction
def _make_csp_decorator(config_attr_name, config_attr_value):
"""General CSP override decorator factory."""
if not isinstance(config_attr_value, dict):
raise TypeError("CSP config should be a mapping.")
def decorator(view_func):... | {
"repo_id": "django/django",
"file_path": "django/views/decorators/csp.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 27,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
django/django:tests/decorators/test_csp.py | from inspect import iscoroutinefunction
from itertools import product
from django.http import HttpRequest, HttpResponse
from django.test import SimpleTestCase
from django.utils.csp import CSP
from django.views.decorators.csp import csp_override, csp_report_only_override
basic_config = {
"default-src": [CSP.SELF],... | {
"repo_id": "django/django",
"file_path": "tests/decorators/test_csp.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 74,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
django/django:docs/lint.py | import re
import sys
from collections import Counter
from os.path import abspath, dirname, splitext
from unittest import mock
from sphinxlint.checkers import (
_ROLE_BODY,
_is_long_interpreted_text,
_is_very_long_string_literal,
_starts_with_anonymous_hyperlink,
_starts_with_directive_or_hyperlink,... | {
"repo_id": "django/django",
"file_path": "docs/lint.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 159,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
django/django:tests/template_tests/syntax_tests/test_partials.py | from django.template import (
Context,
TemplateDoesNotExist,
TemplateSyntaxError,
VariableDoesNotExist,
)
from django.template.base import Token, TokenType
from django.test import SimpleTestCase
from django.views.debug import ExceptionReporter
from ..utils import setup
partial_templates = {
"parti... | {
"repo_id": "django/django",
"file_path": "tests/template_tests/syntax_tests/test_partials.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 592,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
django/django:tests/template_tests/test_partials.py | import os
from unittest import mock
from django.http import HttpResponse
from django.template import (
Context,
NodeList,
Origin,
PartialTemplate,
Template,
TemplateDoesNotExist,
TemplateSyntaxError,
engines,
)
from django.template.backends.django import DjangoTemplates
from django.temp... | {
"repo_id": "django/django",
"file_path": "tests/template_tests/test_partials.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 529,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
django/django:tests/deprecation/test_deprecate_posargs.py | import inspect
import unittest
from typing import TYPE_CHECKING
from django.test import SimpleTestCase
from django.utils.deprecation import RemovedAfterNextVersionWarning, deprecate_posargs
from django.utils.version import PY314
if TYPE_CHECKING:
type AnnotatedKwarg = int
class DeprecatePosargsTests(SimpleTestC... | {
"repo_id": "django/django",
"file_path": "tests/deprecation/test_deprecate_posargs.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 344,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
django/django:django/middleware/csp.py | from django.conf import settings
from django.utils.csp import CSP, LazyNonce, build_policy
from django.utils.deprecation import MiddlewareMixin
def get_nonce(request):
return getattr(request, "_csp_nonce", None)
class ContentSecurityPolicyMiddleware(MiddlewareMixin):
def process_request(self, request):
... | {
"repo_id": "django/django",
"file_path": "django/middleware/csp.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 25,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
django/django:django/utils/csp.py | import secrets
from enum import StrEnum
from django.utils.functional import SimpleLazyObject, empty
class CSP(StrEnum):
"""
Content Security Policy constants for directive values and special tokens.
These constants represent:
1. Standard quoted string values from the CSP spec (e.g., 'self',
'... | {
"repo_id": "django/django",
"file_path": "django/utils/csp.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 82,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
django/django:tests/middleware/test_csp.py | import time
from utils_tests.test_csp import basic_config, basic_policy
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.test import SimpleTestCase
from django.test.selenium import SeleniumTestCase
from django.test.utils import modify_settings, override_settings
from django.utils.cs... | {
"repo_id": "django/django",
"file_path": "tests/middleware/test_csp.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 182,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
django/django:tests/utils_tests/test_csp.py | from secrets import token_urlsafe
from unittest.mock import patch
from django.test import SimpleTestCase
from django.utils.csp import CSP, LazyNonce, build_policy, generate_nonce
from django.utils.functional import empty
basic_config = {
"default-src": [CSP.SELF],
}
alt_config = {
"default-src": [CSP.SELF, CS... | {
"repo_id": "django/django",
"file_path": "tests/utils_tests/test_csp.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 144,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
django/django:tests/postgres_tests/test_app_installed_check.py | from django.core import checks
from django.db import models
from django.test import modify_settings
from django.test.utils import isolate_apps
from . import PostgreSQLTestCase
from .fields import (
BigIntegerRangeField,
DateRangeField,
DateTimeRangeField,
DecimalRangeField,
HStoreField,
Integer... | {
"repo_id": "django/django",
"file_path": "tests/postgres_tests/test_app_installed_check.py",
"license": "BSD 3-Clause \"New\" or \"Revised\" License",
"lines": 122,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
docling-project/docling:tests/test_picture_description_rgb_conversion.py | """Test that PictureDescriptionBaseModel converts non-RGB images to RGB."""
from collections.abc import Iterable
from typing import ClassVar, List, Type
from docling_core.types.doc import DoclingDocument, PictureItem
from PIL import Image
from docling.datamodel.base_models import ItemAndImageEnrichmentElement
from d... | {
"repo_id": "docling-project/docling",
"file_path": "tests/test_picture_description_rgb_conversion.py",
"license": "MIT License",
"lines": 34,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
docling-project/docling:docling/backend/xml/xbrl_backend.py | """Backend to parse XBRL (eXtensible Business Reporting Language) documents.
XBRL is a standard XML format used for business and financial reporting.
It is widely used by companies, regulators, and financial institutions worldwide
for exchanging financial information.
This backend leverages the Arelle library for XBR... | {
"repo_id": "docling-project/docling",
"file_path": "docling/backend/xml/xbrl_backend.py",
"license": "MIT License",
"lines": 263,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:tests/test_backend_xbrl.py | """Test module for the XBRL backend parser.
The data used in this test is in the public domain. It has been downloaded from the
U.S. Securities and Exchange Commission (SEC)'s Electronic Data Gathering, Analysis,
and Retrieval (EDGAR) system.
"""
import os
from io import BytesIO
from pathlib import Path
import pytes... | {
"repo_id": "docling-project/docling",
"file_path": "tests/test_backend_xbrl.py",
"license": "MIT License",
"lines": 68,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
docling-project/docling:docling/datamodel/image_classification_engine_options.py | """Engine option helpers for image-classification runtimes."""
from __future__ import annotations
from typing import Any, Dict, List, Literal, Optional
from pydantic import AnyUrl, Field
from docling.datamodel.settings import default_compile_model
from docling.models.inference_engines.image_classification.base impo... | {
"repo_id": "docling-project/docling",
"file_path": "docling/datamodel/image_classification_engine_options.py",
"license": "MIT License",
"lines": 72,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling:docling/datamodel/picture_classification_options.py | """Options for picture classification stages."""
from __future__ import annotations
from typing import ClassVar
from pydantic import BaseModel, Field
from docling.datamodel import stage_model_specs
from docling.datamodel.stage_model_specs import (
ImageClassificationModelSpec,
ImageClassificationStagePreset... | {
"repo_id": "docling-project/docling",
"file_path": "docling/datamodel/picture_classification_options.py",
"license": "MIT License",
"lines": 41,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling:docling/models/inference_engines/common/hf_vision_base.py | """Shared HuggingFace helpers for vision inference engine families."""
from __future__ import annotations
import logging
from numbers import Integral, Real
from pathlib import Path
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
import numpy as np
from docling.datamodel.accelerator_options import Accel... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/common/hf_vision_base.py",
"license": "MIT License",
"lines": 126,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/common/kserve_v2_http.py | """Utilities for calling KServe v2 REST inference endpoints.
Note: This is a minimal synchronous implementation. The official KServe Python SDK
(https://github.com/kserve/kserve) provides an async InferenceRESTClient with similar
functionality, but is currently in alpha and requires async/await support.
"""
from __fu... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/common/kserve_v2_http.py",
"license": "MIT License",
"lines": 208,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/image_classification/api_kserve_v2_engine.py | """KServe v2 remote implementation for image-classification models."""
from __future__ import annotations
import logging
from pathlib import Path
from typing import TYPE_CHECKING, List, Optional, Union
import numpy as np
from docling.datamodel.accelerator_options import AcceleratorOptions
from docling.datamodel.ima... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/image_classification/api_kserve_v2_engine.py",
"license": "MIT License",
"lines": 132,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/image_classification/base.py | """Base classes for image-classification inference engines."""
from __future__ import annotations
import logging
from abc import ABC, abstractmethod
from enum import Enum
from typing import (
TYPE_CHECKING,
Any,
ClassVar,
Dict,
List,
Literal,
Optional,
Type,
get_args,
get_origi... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/image_classification/base.py",
"license": "MIT License",
"lines": 150,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/image_classification/factory.py | """Factory for creating image-classification engines."""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Optional, Union
from docling.datamodel.accelerator_options import AcceleratorOptions
from docling.models.inference_engines.image_classification.base import (
Base... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/image_classification/factory.py",
"license": "MIT License",
"lines": 83,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/image_classification/hf_base.py | """Shared HuggingFace-based helpers for image-classification engines."""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Any, Iterable, Optional, Union
import numpy as np
from docling.datamodel.accelerator_options import AcceleratorOptions
from docling.models.inference_... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/image_classification/hf_base.py",
"license": "MIT License",
"lines": 88,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling:docling/models/inference_engines/image_classification/onnxruntime_engine.py | """ONNX Runtime implementation for image-classification models."""
from __future__ import annotations
import logging
from pathlib import Path
from typing import TYPE_CHECKING, List, Optional, Union
import numpy as np
if TYPE_CHECKING:
import onnxruntime as ort
from docling.datamodel.accelerator_options import ... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/image_classification/onnxruntime_engine.py",
"license": "MIT License",
"lines": 158,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/image_classification/transformers_engine.py | """Transformers implementation for image-classification models."""
from __future__ import annotations
import logging
import sys
from pathlib import Path
from typing import TYPE_CHECKING, List, Optional, Union
from packaging import version
if TYPE_CHECKING:
import torch
from transformers import AutoModelForI... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/image_classification/transformers_engine.py",
"license": "MIT License",
"lines": 157,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/object_detection/api_kserve_v2_engine.py | """KServe v2 remote implementation for object-detection models."""
from __future__ import annotations
import logging
from pathlib import Path
from typing import TYPE_CHECKING, List, Optional, Union
import numpy as np
from docling.datamodel.accelerator_options import AcceleratorOptions
from docling.datamodel.object_... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/object_detection/api_kserve_v2_engine.py",
"license": "MIT License",
"lines": 178,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:tests/test_api_kserve_v2_engine_scaffolding.py | """Tests for API KServe v2 remote engine scaffolding."""
from __future__ import annotations
from typing import ClassVar
import pytest
from pydantic import BaseModel
from docling.datamodel.accelerator_options import AcceleratorOptions
from docling.datamodel.image_classification_engine_options import (
ApiKserveV... | {
"repo_id": "docling-project/docling",
"file_path": "tests/test_api_kserve_v2_engine_scaffolding.py",
"license": "MIT License",
"lines": 137,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
docling-project/docling:tests/test_backend_docling_parse_legacy.py | from pathlib import Path
import pytest
from docling.backend.docling_parse_v2_backend import DoclingParseV2DocumentBackend
from docling.backend.docling_parse_v4_backend import DoclingParseV4DocumentBackend
from docling.datamodel.base_models import InputFormat
from docling.datamodel.document import InputDocument
INPUT... | {
"repo_id": "docling-project/docling",
"file_path": "tests/test_backend_docling_parse_legacy.py",
"license": "MIT License",
"lines": 16,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
docling-project/docling:tests/test_failed_pages.py | """Tests for failed page handling in StandardPdfPipeline.
These tests verify that when some PDF pages fail to parse, they are still
added to DoclingDocument.pages to maintain correct page numbering and
ensure page break markers are generated correctly during export.
Related: https://github.com/docling-project/docling... | {
"repo_id": "docling-project/docling",
"file_path": "tests/test_failed_pages.py",
"license": "MIT License",
"lines": 169,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
docling-project/docling:docling/datamodel/object_detection_engine_options.py | """Engine option helpers for object-detection runtimes."""
from __future__ import annotations
from typing import Any, Dict, List, Literal, Optional
from pydantic import AnyUrl, Field
from docling.datamodel.settings import default_compile_model
from docling.models.inference_engines.object_detection.base import (
... | {
"repo_id": "docling-project/docling",
"file_path": "docling/datamodel/object_detection_engine_options.py",
"license": "MIT License",
"lines": 73,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling:docling/models/inference_engines/object_detection/base.py | """Base classes for object-detection inference engines."""
from __future__ import annotations
import logging
from abc import ABC, abstractmethod
from enum import Enum
from typing import (
TYPE_CHECKING,
Any,
ClassVar,
Dict,
List,
Literal,
Optional,
Type,
get_args,
get_origin,
)... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/object_detection/base.py",
"license": "MIT License",
"lines": 158,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/object_detection/factory.py | """Factory for creating object detection engines."""
from __future__ import annotations
import logging
from pathlib import Path
from typing import TYPE_CHECKING, Optional, Union
from docling.datamodel.accelerator_options import AcceleratorOptions
from docling.models.inference_engines.object_detection.base import (
... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/object_detection/factory.py",
"license": "MIT License",
"lines": 92,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/object_detection/hf_base.py | """Shared HuggingFace-based helpers for object-detection engines."""
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, Any, Iterable, Optional, Sequence, Union
from docling.datamodel.accelerator_options import AcceleratorOptions
from docling.models.inference_engines.common... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/object_detection/hf_base.py",
"license": "MIT License",
"lines": 58,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling:docling/models/inference_engines/object_detection/onnxruntime_engine.py | """ONNX Runtime implementation for RT-DETR style object-detection models."""
from __future__ import annotations
import logging
from pathlib import Path
from typing import TYPE_CHECKING, List, Optional, Union
import numpy as np
if TYPE_CHECKING:
import onnxruntime as ort
from docling.datamodel.accelerator_optio... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/object_detection/onnxruntime_engine.py",
"license": "MIT License",
"lines": 167,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/object_detection/transformers_engine.py | """Transformers implementation for object-detection models."""
from __future__ import annotations
import logging
import sys
from pathlib import Path
from typing import TYPE_CHECKING, List, Optional, Union
from packaging import version
if TYPE_CHECKING:
import torch
from transformers import AutoModelForObjec... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/object_detection/transformers_engine.py",
"license": "MIT License",
"lines": 185,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/stages/layout/layout_object_detection_model.py | """Layout detection stage backed by object-detection runtimes."""
from __future__ import annotations
import logging
from pathlib import Path
from typing import Dict, List, Optional, Sequence
import numpy as np
from docling_core.types.doc import CoordOrigin, DocItemLabel
from PIL import Image
from docling.datamodel.... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/stages/layout/layout_object_detection_model.py",
"license": "MIT License",
"lines": 147,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/backend/latex_backend.py | import logging
import re
from copy import deepcopy
from io import BytesIO
from pathlib import Path
from typing import Callable, List, Optional, Union
import pypdfium2
from docling_core.types.doc import (
DocItemLabel,
DoclingDocument,
GroupLabel,
ImageRef,
NodeItem,
TableCell,
TableData,
... | {
"repo_id": "docling-project/docling",
"file_path": "docling/backend/latex_backend.py",
"license": "MIT License",
"lines": 1228,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:tests/test_backend_latex.py | from io import BytesIO
from pathlib import Path
import pytest
from docling_core.types.doc import DocItemLabel, GroupLabel
from docling.backend.latex_backend import LatexDocumentBackend
from docling.datamodel.base_models import InputFormat
from docling.datamodel.document import ConversionResult, DoclingDocument, Input... | {
"repo_id": "docling-project/docling",
"file_path": "tests/test_backend_latex.py",
"license": "MIT License",
"lines": 1164,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
docling-project/docling:docling/datamodel/stage_model_specs.py | """Model specifications and presets for stage models.
This module defines:
1. VlmModelSpec - Model configuration with engine-specific overrides
2. StageModelPreset - Preset combining model, engine, and stage config
3. StagePresetMixin - Mixin for stage options to manage presets
"""
import logging
from typing import T... | {
"repo_id": "docling-project/docling",
"file_path": "docling/datamodel/stage_model_specs.py",
"license": "MIT License",
"lines": 1119,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/datamodel/vlm_engine_options.py | """Engine options for VLM inference.
This module defines engine-specific configuration options that are independent
of model specifications and prompts.
"""
import logging
from typing import Any, Dict, Literal, Optional
from pydantic import AnyUrl, Field
from docling.datamodel.accelerator_options import Accelerator... | {
"repo_id": "docling-project/docling",
"file_path": "docling/datamodel/vlm_engine_options.py",
"license": "MIT License",
"lines": 125,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/vlm/_utils.py | """Internal utilities for VLM runtimes.
This module contains shared utility functions used across different VLM runtime
implementations to avoid code duplication and ensure consistency.
"""
import logging
from pathlib import Path
from typing import Any, Callable, Dict, List, Optional, Union
import numpy as np
from P... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/vlm/_utils.py",
"license": "MIT License",
"lines": 159,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/vlm/api_openai_compatible_engine.py | """API-based VLM inference engine for remote services."""
import asyncio
import logging
import time
from concurrent.futures import ThreadPoolExecutor
from typing import TYPE_CHECKING, List, Optional
from PIL.Image import Image
from docling.datamodel.vlm_engine_options import ApiVlmEngineOptions
from docling.exceptio... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/vlm/api_openai_compatible_engine.py",
"license": "MIT License",
"lines": 179,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/vlm/auto_inline_engine.py | """Auto-inline VLM inference engine that selects the best local engine."""
import logging
import platform
from pathlib import Path
from typing import TYPE_CHECKING, List, Optional, Union
from docling.datamodel.accelerator_options import AcceleratorDevice, AcceleratorOptions
from docling.datamodel.vlm_engine_options i... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/vlm/auto_inline_engine.py",
"license": "MIT License",
"lines": 197,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/vlm/base.py | """Base classes for VLM inference engines."""
import logging
from abc import ABC, abstractmethod
from enum import Enum
from typing import (
TYPE_CHECKING,
Any,
ClassVar,
Dict,
List,
Literal,
Optional,
Type,
get_args,
get_origin,
)
from PIL.Image import Image
from pydantic impor... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/vlm/base.py",
"license": "MIT License",
"lines": 209,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/vlm/factory.py | """Factory for creating VLM inference engines."""
import logging
from pathlib import Path
from typing import TYPE_CHECKING, Optional, Union
from docling.datamodel.accelerator_options import AcceleratorOptions
from docling.models.inference_engines.vlm.base import (
BaseVlmEngine,
BaseVlmEngineOptions,
VlmE... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/vlm/factory.py",
"license": "MIT License",
"lines": 111,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/vlm/mlx_engine.py | """MLX-based VLM inference engine for Apple Silicon."""
import logging
import threading
import time
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, List, Optional, Union
from PIL.Image import Image
from docling.datamodel.vlm_engine_options import MlxVlmEngineOptions
from docling.models.infe... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/vlm/mlx_engine.py",
"license": "MIT License",
"lines": 238,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/vlm/transformers_engine.py | """Transformers-based VLM inference engine."""
import importlib.metadata
import logging
import sys
import time
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, List, Optional, Union
import torch
from packaging import version
from PIL.Image import Image
from transformers import (
AutoModel... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/vlm/transformers_engine.py",
"license": "MIT License",
"lines": 394,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/inference_engines/vlm/vllm_engine.py | """vLLM-based VLM inference engine for high-throughput serving."""
import logging
import sys
import time
from pathlib import Path
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
from docling.datamodel.accelerator_options import AcceleratorDevice, AcceleratorOptions
from docling.datamodel.pipeline_o... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/inference_engines/vlm/vllm_engine.py",
"license": "MIT License",
"lines": 301,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/stages/code_formula/code_formula_vlm_model.py | """Code and formula extraction stage using the new VLM runtime system.
This module provides a runtime-agnostic code and formula extraction stage that can use
any VLM runtime (Transformers, MLX, API, etc.) through the unified runtime interface.
"""
import logging
import re
from collections.abc import Iterable
from pat... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/stages/code_formula/code_formula_vlm_model.py",
"license": "MIT License",
"lines": 243,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/stages/picture_description/picture_description_vlm_engine_model.py | """Picture description stage using the VLM engine system.
This module provides an engine-agnostic picture description stage that can use
any VLM engine (Transformers, MLX, API, etc.) through the unified engine interface.
"""
import logging
from collections.abc import Iterable
from pathlib import Path
from typing impo... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/stages/picture_description/picture_description_vlm_engine_model.py",
"license": "MIT License",
"lines": 132,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ... | function_complex |
docling-project/docling:docling/models/stages/vlm_convert/vlm_convert_model.py | """VLM-based document conversion stage using the new runtime system.
This stage converts document pages to structured formats (DocTags, Markdown, etc.)
using vision-language models through a pluggable runtime system.
"""
import logging
from collections.abc import Iterable
from pathlib import Path
from typing import O... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/stages/vlm_convert/vlm_convert_model.py",
"license": "MIT License",
"lines": 217,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docs/examples/code_formula_granite_docling.py | """Example: Comparing CodeFormula models for code and formula extraction.
This example demonstrates how to use both the CodeFormulaV2 model
and the Granite Docling model for extracting code blocks and mathematical
formulas from PDF documents, allowing you to compare their outputs.
"""
from pathlib import Path
from d... | {
"repo_id": "docling-project/docling",
"file_path": "docs/examples/code_formula_granite_docling.py",
"license": "MIT License",
"lines": 89,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docs/examples/legacy/minimal_vlm_pipeline_legacy.py | # %% [markdown]
# Minimal VLM pipeline example (LEGACY VERSION - for backward compatibility testing)
#
# **NOTE:** This is the legacy version using `vlm_model_specs` directly.
# For the new preset-based approach, see `minimal_vlm_pipeline.py`.
# This file is kept to validate backward compatibility with the old API.
#
#... | {
"repo_id": "docling-project/docling",
"file_path": "docs/examples/legacy/minimal_vlm_pipeline_legacy.py",
"license": "MIT License",
"lines": 62,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling:docs/examples/legacy/picture_description_inline_legacy.py | # %% [markdown]
# Picture Description with Legacy VLM Options
#
# This example demonstrates the LEGACY approach using PictureDescriptionVlmOptions
# with direct repo_id specification (no preset system).
#
# For the NEW approach with preset support, see: picture_description_inline.py
#
# What this example does:
# - Uses... | {
"repo_id": "docling-project/docling",
"file_path": "docs/examples/legacy/picture_description_inline_legacy.py",
"license": "MIT License",
"lines": 95,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docs/examples/legacy/pictures_description_api_legacy.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... | {
"repo_id": "docling-project/docling",
"file_path": "docs/examples/legacy/pictures_description_api_legacy.py",
"license": "MIT License",
"lines": 150,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling:docs/examples/legacy/vlm_pipeline_api_model_legacy.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... | {
"repo_id": "docling-project/docling",
"file_path": "docs/examples/legacy/vlm_pipeline_api_model_legacy.py",
"license": "MIT License",
"lines": 233,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docs/examples/picture_description_inline.py | # %% [markdown]
# Picture Description with Inline VLM Models
#
# What this example does
# - Demonstrates picture description in standard PDF pipeline
# - Shows default preset, changing presets, and manual configuration without presets
# - Enriches documents with AI-generated image captions
#
# Prerequisites
# - Install... | {
"repo_id": "docling-project/docling",
"file_path": "docs/examples/picture_description_inline.py",
"license": "MIT License",
"lines": 135,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:tests/test_vlm_presets_and_runtime_options.py | """Tests for VLM preset system and runtime options management.
This test suite validates:
1. Preset registration and retrieval
2. Runtime options creation and validation
3. Preset-based options creation with runtime overrides
4. Model spec runtime-specific configurations
5. All three stage types (VlmConvert, PictureDe... | {
"repo_id": "docling-project/docling",
"file_path": "tests/test_vlm_presets_and_runtime_options.py",
"license": "MIT License",
"lines": 455,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
docling-project/docling:docs/examples/chart_extraction.py | # %% [markdown]
# Extract chart data from a PDF and export the result as split-page HTML with layout.
#
# What this example does
# - Converts a PDF with chart extraction enrichment enabled.
# - Iterates detected pictures and prints extracted chart data as CSV to stdout.
# - Saves the converted document as split-page HT... | {
"repo_id": "docling-project/docling",
"file_path": "docs/examples/chart_extraction.py",
"license": "MIT License",
"lines": 104,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/models/stages/chart_extraction/granite_vision.py | import logging
import re
from collections.abc import Iterable
from io import StringIO
from pathlib import Path
from typing import List, Literal, Optional
import pandas as pd
from docling_core.types.doc import (
DoclingDocument,
NodeItem,
PictureClassificationMetaField,
PictureItem,
PictureMeta,
... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/stages/chart_extraction/granite_vision.py",
"license": "MIT License",
"lines": 320,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:tests/test_picture_description_filters.py | from docling_core.types.doc import (
PictureClassificationLabel,
PictureClassificationMetaField,
PictureMeta,
)
from docling.models.picture_description_base_model import _passes_classification
def _meta_with_predictions(predictions):
return PictureMeta(
classification=PictureClassificationMet... | {
"repo_id": "docling-project/docling",
"file_path": "tests/test_picture_description_filters.py",
"license": "MIT License",
"lines": 50,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
docling-project/docling:docling/utils/deepseekocr_utils.py | """Utilities for parsing DeepSeek OCR annotated markdown format."""
import logging
import re
from typing import Optional, Union
from docling_core.types.doc import (
BoundingBox,
CoordOrigin,
DocItemLabel,
DoclingDocument,
DocumentOrigin,
ImageRef,
ProvenanceItem,
RefItem,
Size,
... | {
"repo_id": "docling-project/docling",
"file_path": "docling/utils/deepseekocr_utils.py",
"license": "MIT License",
"lines": 335,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:tests/test_deepseekocr_vlm.py | """Test DeepSeek OCR markdown parsing in VLM pipeline."""
import json
import os
import sys
from pathlib import Path
import pytest
from docling_core.types.doc import DoclingDocument, Size
from PIL import Image as PILImage
from docling.datamodel import vlm_model_specs
from docling.datamodel.base_models import (
In... | {
"repo_id": "docling-project/docling",
"file_path": "tests/test_deepseekocr_vlm.py",
"license": "MIT License",
"lines": 126,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
docling-project/docling: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... | {
"repo_id": "docling-project/docling",
"file_path": "docs/examples/post_process_ocr_with_vlm.py",
"license": "MIT License",
"lines": 634,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/experimental/datamodel/table_crops_layout_options.py | """Internal options for the experimental TableCrops layout model."""
from typing import ClassVar
from docling.datamodel.pipeline_options import BaseLayoutOptions
__all__ = ["TableCropsLayoutOptions"]
class TableCropsLayoutOptions(BaseLayoutOptions):
"""Options for TableCropsLayoutModel (internal-only)."""
... | {
"repo_id": "docling-project/docling",
"file_path": "docling/experimental/datamodel/table_crops_layout_options.py",
"license": "MIT License",
"lines": 7,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling:docling/experimental/models/table_crops_layout_model.py | """Internal TableCrops layout model that marks full pages as table clusters."""
from __future__ import annotations
import warnings
from collections.abc import Sequence
from pathlib import Path
from typing import Optional
import numpy as np
from docling_core.types.doc import DocItemLabel
from docling.datamodel.accel... | {
"repo_id": "docling-project/docling",
"file_path": "docling/experimental/models/table_crops_layout_model.py",
"license": "MIT License",
"lines": 90,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling: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 ... | {
"repo_id": "docling-project/docling",
"file_path": "docs/examples/experimental/process_table_crops.py",
"license": "MIT License",
"lines": 32,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling:docling/models/base_layout_model.py | from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import Iterable, Sequence
from typing import Type
from docling.datamodel.base_models import LayoutPrediction, Page
from docling.datamodel.document import ConversionResult
from docling.datamodel.pipeline_options import BaseLayo... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/base_layout_model.py",
"license": "MIT License",
"lines": 31,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling:docling/models/base_table_model.py | from __future__ import annotations
from abc import ABC, abstractmethod
from collections.abc import Iterable, Sequence
from typing import Type
from docling.datamodel.base_models import Page, TableStructurePrediction
from docling.datamodel.document import ConversionResult
from docling.datamodel.pipeline_options import ... | {
"repo_id": "docling-project/docling",
"file_path": "docling/models/base_table_model.py",
"license": "MIT License",
"lines": 35,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling:docling/models/factories/layout_factory.py | from docling.models.base_layout_model import BaseLayoutModel
from docling.models.factories.base_factory import BaseFactory
class LayoutFactory(BaseFactory[BaseLayoutModel]):
def __init__(self, *args, **kwargs):
super().__init__("layout_engines", *args, **kwargs)
| {
"repo_id": "docling-project/docling",
"file_path": "docling/models/factories/layout_factory.py",
"license": "MIT License",
"lines": 5,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling:docling/models/factories/table_factory.py | from docling.models.base_table_model import BaseTableStructureModel
from docling.models.factories.base_factory import BaseFactory
class TableStructureFactory(BaseFactory[BaseTableStructureModel]):
def __init__(self, *args, **kwargs):
super().__init__("table_structure_engines", *args, **kwargs)
| {
"repo_id": "docling-project/docling",
"file_path": "docling/models/factories/table_factory.py",
"license": "MIT License",
"lines": 5,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling: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... | {
"repo_id": "docling-project/docling",
"file_path": "tests/test_conversion_result_json.py",
"license": "MIT License",
"lines": 34,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
docling-project/docling: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... | {
"repo_id": "docling-project/docling",
"file_path": "docs/examples/suryaocr_with_custom_models.py",
"license": "MIT License",
"lines": 45,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling: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... | {
"repo_id": "docling-project/docling",
"file_path": "docs/examples/parquet_images.py",
"license": "MIT License",
"lines": 168,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling: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... | {
"repo_id": "docling-project/docling",
"file_path": "tests/test_backend_image_native.py",
"license": "MIT License",
"lines": 172,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | test |
docling-project/docling:docling/experimental/datamodel/threaded_layout_vlm_pipeline_options.py | """Options for the threaded layout+VLM pipeline."""
from typing import Union
from pydantic import model_validator
from docling.datamodel.layout_model_specs import DOCLING_LAYOUT_HERON
from docling.datamodel.pipeline_options import LayoutOptions, PaginatedPipelineOptions
from docling.datamodel.pipeline_options_vlm_mo... | {
"repo_id": "docling-project/docling",
"file_path": "docling/experimental/datamodel/threaded_layout_vlm_pipeline_options.py",
"license": "MIT License",
"lines": 35,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
docling-project/docling:docling/experimental/pipeline/threaded_layout_vlm_pipeline.py | """Threaded Layout+VLM Pipeline
================================
A specialized two-stage threaded pipeline that combines layout model preprocessing
with VLM processing. The layout model detects document elements and coordinates,
which are then injected into the VLM prompt for enhanced structured output.
"""
from __fut... | {
"repo_id": "docling-project/docling",
"file_path": "docling/experimental/pipeline/threaded_layout_vlm_pipeline.py",
"license": "MIT License",
"lines": 375,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling: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... | {
"repo_id": "docling-project/docling",
"file_path": "docs/examples/demo_layout_vlm.py",
"license": "MIT License",
"lines": 147,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling:docling/pipeline/legacy_standard_pdf_pipeline.py | import logging
import warnings
from pathlib import Path
from typing import Optional, cast
import numpy as np
from docling_core.types.doc import DocItem, ImageRef, PictureItem, TableItem
from docling.backend.abstract_backend import AbstractDocumentBackend
from docling.backend.pdf_backend import PdfDocumentBackend
from... | {
"repo_id": "docling-project/docling",
"file_path": "docling/pipeline/legacy_standard_pdf_pipeline.py",
"license": "MIT License",
"lines": 235,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_complex |
docling-project/docling: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... | {
"repo_id": "docling-project/docling",
"file_path": "docs/examples/gpu_standard_pipeline.py",
"license": "MIT License",
"lines": 67,
"canary_id": -1,
"canary_value": "",
"pii_type": "",
"provider": "",
"regex_pattern": "",
"repetition": -1,
"template": ""
} | function_simple |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.