id int64 0 458k | file_name stringlengths 4 119 | file_path stringlengths 14 227 | content stringlengths 24 9.96M | size int64 24 9.96M | language stringclasses 1
value | extension stringclasses 14
values | total_lines int64 1 219k | avg_line_length float64 2.52 4.63M | max_line_length int64 5 9.91M | alphanum_fraction float64 0 1 | repo_name stringlengths 7 101 | repo_stars int64 100 139k | repo_forks int64 0 26.4k | repo_open_issues int64 0 2.27k | repo_license stringclasses 12
values | repo_extraction_date stringclasses 433
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
32,900 | pdfa.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/pdfa.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Utilities for PDF/A production and confirmation with Ghostspcript."""
from __future__ import annotations
import base64
from collections.abc import Iterator
from importlib.resources import files as package_files
from pathlib import P... | 4,331 | Python | .py | 104 | 34.932692 | 84 | 0.651988 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,901 | _graft.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/_graft.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""For grafting text-only PDF pages onto freeform PDF pages."""
from __future__ import annotations
import logging
from contextlib import suppress
from enum import Enum
from pathlib import Path
from pikepdf import (
Dictionary,
... | 12,247 | Python | .py | 276 | 33.307971 | 88 | 0.586947 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,902 | _concurrent.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/_concurrent.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""OCRmyPDF concurrency abstractions."""
from __future__ import annotations
import threading
from abc import ABC, abstractmethod
from collections.abc import Callable, Iterable
from typing import Any, TypeVar
from ocrmypdf._progressbar... | 4,308 | Python | .py | 106 | 31.273585 | 86 | 0.629576 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,903 | exceptions.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/exceptions.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""OCRmyPDF's exceptions."""
from __future__ import annotations
from enum import IntEnum
from textwrap import dedent
class ExitCode(IntEnum):
"""OCRmyPDF's exit codes."""
# pylint: disable=invalid-name
ok = 0
bad_arg... | 3,763 | Python | .py | 101 | 31.316832 | 75 | 0.690114 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,904 | optimize.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/optimize.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Post-processing image optimization of OCR PDFs."""
from __future__ import annotations
import logging
import sys
import tempfile
import threading
from collections import defaultdict
from collections.abc import Callable, Iterator, Mut... | 26,586 | Python | .py | 666 | 31.181682 | 87 | 0.617331 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,905 | _validation.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/_validation.py | #!/usr/bin/env python3
# SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Validate a work order from API or command line."""
from __future__ import annotations
import locale
import logging
import os
import sys
import unicodedata
from argparse import Namespace
from collections.abc im... | 13,273 | Python | .py | 315 | 33.136508 | 88 | 0.625523 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,906 | helpers.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/helpers.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Support functions."""
from __future__ import annotations
import logging
import multiprocessing
import os
import shutil
import warnings
from collections.abc import Callable, Iterable, Sequence
from contextlib import suppress
from dec... | 10,980 | Python | .py | 267 | 33.044944 | 88 | 0.62783 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,907 | pluginspec.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/pluginspec.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""OCRmyPDF pluggy plugin specification."""
from __future__ import annotations
from abc import ABC, abstractmethod
from argparse import ArgumentParser, Namespace
from collections.abc import Sequence, Set
from logging import Handler
fro... | 21,765 | Python | .py | 435 | 43.365517 | 88 | 0.714279 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,908 | __init__.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/data/__init__.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Data files used to generate certain PDFs."""
from __future__ import annotations
| 166 | Python | .py | 4 | 40.25 | 47 | 0.770186 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,909 | jbig2enc.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/_exec/jbig2enc.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Interface to jbig2 executable."""
from __future__ import annotations
from subprocess import PIPE, CalledProcessError
from packaging.version import Version
from ocrmypdf.exceptions import MissingDependencyError
from ocrmypdf.subpro... | 1,528 | Python | .py | 44 | 29.068182 | 78 | 0.668253 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,910 | unpaper.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/_exec/unpaper.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Interface to unpaper executable."""
from __future__ import annotations
import logging
import os
import shlex
from collections.abc import Iterator
from contextlib import contextmanager
from decimal import Decimal
from pathlib import ... | 4,490 | Python | .py | 111 | 33.567568 | 82 | 0.654111 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,911 | tesseract.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/_exec/tesseract.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Interface to Tesseract executable."""
from __future__ import annotations
import logging
import re
from contextlib import suppress
from math import pi
from os import fspath
from pathlib import Path
from subprocess import PIPE, STDOUT... | 12,396 | Python | .py | 330 | 30.109091 | 88 | 0.610537 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,912 | __init__.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/_exec/__init__.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Manage third party executables."""
from __future__ import annotations
| 157 | Python | .py | 4 | 37.75 | 46 | 0.774834 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,913 | ghostscript.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/_exec/ghostscript.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Interface to Ghostscript executable."""
from __future__ import annotations
import logging
import os
import re
from collections import deque
from io import BytesIO
from os import fspath
from pathlib import Path
from subprocess import... | 10,152 | Python | .py | 272 | 28.238971 | 83 | 0.5975 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,914 | pngquant.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/_exec/pngquant.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Interface to pngquant executable."""
from __future__ import annotations
from pathlib import Path
from subprocess import PIPE
from packaging.version import Version
from ocrmypdf.exceptions import MissingDependencyError
from ocrmypd... | 1,464 | Python | .py | 39 | 30.871795 | 86 | 0.656516 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,915 | __init__.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/subprocess/__init__.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Wrappers to manage subprocess calls."""
from __future__ import annotations
import logging
import os
import re
import sys
from collections.abc import Callable, Mapping, Sequence
from contextlib import suppress
from pathlib import Path... | 11,588 | Python | .py | 288 | 33.864583 | 87 | 0.676212 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,916 | _windows.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/subprocess/_windows.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Find Tesseract and Ghostscript binaries on Windows using the registry."""
from __future__ import annotations
import logging
import os
import re
import shutil
import sys
from collections.abc import Callable, Iterable, Iterator
from it... | 6,227 | Python | .py | 162 | 31.37037 | 87 | 0.631938 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,917 | ocr.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/_pipelines/ocr.py | # SPDX-FileCopyrightText: 2019-2023 James R. Barlow
# SPDX-FileCopyrightText: 2019 Martin Wind
# SPDX-License-Identifier: MPL-2.0
"""Implements the concurrent and page synchronous parts of the pipeline."""
from __future__ import annotations
import argparse
import logging
import logging.handlers
from collections.abc ... | 7,090 | Python | .py | 188 | 30.867021 | 87 | 0.681375 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,918 | __init__.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/_pipelines/__init__.py | # SPDX-FileCopyrightText: 2023 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
| 119 | Python | .py | 3 | 38 | 46 | 0.789474 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,919 | hocr_to_ocr_pdf.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/_pipelines/hocr_to_ocr_pdf.py | # SPDX-FileCopyrightText: 2019-2023 James R. Barlow
# SPDX-FileCopyrightText: 2019 Martin Wind
# SPDX-License-Identifier: MPL-2.0
"""Implements the concurrent and page synchronous parts of the pipeline."""
from __future__ import annotations
import argparse
import logging
import logging.handlers
from collections.abc ... | 4,362 | Python | .py | 114 | 31.27193 | 87 | 0.677465 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,920 | _common.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/_pipelines/_common.py | # SPDX-FileCopyrightText: 2023 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import argparse
import json
import logging
import logging.handlers
import os
import shutil
import sys
import threading
from collections.abc import Callable, Sequence
from concurrent.futures.process imp... | 14,893 | Python | .py | 389 | 30.575835 | 88 | 0.651475 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,921 | pdf_to_hocr.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/_pipelines/pdf_to_hocr.py | # SPDX-FileCopyrightText: 2019-2023 James R. Barlow
# SPDX-FileCopyrightText: 2019 Martin Wind
# SPDX-License-Identifier: MPL-2.0
"""Implements the concurrent and page synchronous parts of the pipeline."""
from __future__ import annotations
import argparse
import logging
import logging.handlers
import shutil
from fu... | 3,538 | Python | .py | 98 | 29.826531 | 82 | 0.69033 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,922 | layout.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/pdfinfo/layout.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Detailed text position and layout analysis, building on pdfminer.six."""
from __future__ import annotations
import re
from collections.abc import Iterator, Mapping
from contextlib import contextmanager
from math import copysign
from ... | 10,270 | Python | .py | 281 | 28.708185 | 88 | 0.637287 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,923 | __init__.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/pdfinfo/__init__.py | #!/usr/bin/env python3
# SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""For extracting information about PDFs prior to OCR."""
from __future__ import annotations
from ocrmypdf.pdfinfo.info import Colorspace, Encoding, PageInfo, PdfInfo
__all__ = ["Colorspace", "Encoding", "PageIn... | 336 | Python | .py | 7 | 46.428571 | 73 | 0.76 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,924 | info.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/pdfinfo/info.py | #!/usr/bin/env python3
# SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Extract information about the content of a PDF."""
from __future__ import annotations
import atexit
import logging
import re
import statistics
from collections import defaultdict
from collections.abc import Ca... | 42,826 | Python | .py | 1,023 | 33.620723 | 97 | 0.635181 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,925 | default_filters.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/builtin_plugins/default_filters.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""OCRmyPDF automatically installs these filters as plugins."""
from __future__ import annotations
from ocrmypdf import hookimpl
@hookimpl
def filter_pdf_page(page, image_filename, output_pdf): # pylint: disable=unused-argument
r... | 337 | Python | .py | 8 | 40.125 | 89 | 0.793846 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,926 | tesseract_ocr.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/builtin_plugins/tesseract_ocr.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Built-in plugin to implement OCR using Tesseract."""
from __future__ import annotations
import argparse
import logging
import os
from PIL import Image
from ocrmypdf import hookimpl
from ocrmypdf._exec import tesseract
from ocrmypdf... | 11,252 | Python | .py | 271 | 33.162362 | 87 | 0.651356 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,927 | __init__.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/builtin_plugins/__init__.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Plugins in this package are automatically loaded by ocrmypdf."""
from __future__ import annotations
| 187 | Python | .py | 4 | 45.25 | 67 | 0.78453 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,928 | ghostscript.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/builtin_plugins/ghostscript.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Built-in plugin to implement PDF page rasterization and PDF/A production."""
from __future__ import annotations
import logging
from packaging.version import Version
from ocrmypdf import hookimpl
from ocrmypdf._exec import ghostscri... | 4,737 | Python | .py | 126 | 30.952381 | 88 | 0.673412 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,929 | optimize.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/builtin_plugins/optimize.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Built-in plugin to implement PDF page optimization."""
from __future__ import annotations
import argparse
import logging
from collections.abc import Sequence
from pathlib import Path
from ocrmypdf import Executor, PdfContext, hookim... | 5,123 | Python | .py | 151 | 25.84106 | 85 | 0.608713 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,930 | concurrency.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/builtin_plugins/concurrency.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""OCRmyPDF's multiprocessing/multithreading abstraction layer."""
from __future__ import annotations
import logging
import logging.handlers
import multiprocessing
import os
import queue
import signal
import sys
import threading
from co... | 6,901 | Python | .py | 153 | 37.169935 | 106 | 0.683058 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,931 | __init__.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/extra_plugins/__init__.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
#
# SPDX-License-Identifier: MPL-2.0
"""Extra plugins. These are not automatically inserted when ocrmypdf is run.
You can use these plugins by specifying them on the command line, e.g.:
ocrmypdf --plugin ocrmypdf.extra_plugins.semfree ...
"""
| 292 | Python | .py | 7 | 40.428571 | 76 | 0.777385 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,932 | semfree.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/extra_plugins/semfree.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Semaphore-free alternate executor.
There are two popular environments that do not fully support the standard Python
multiprocessing module: AWS Lambda, and Termux (a terminal emulator for Android).
This alternate executor divvies up ... | 6,777 | Python | .py | 163 | 32.392638 | 82 | 0.637249 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,933 | __main__.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/hocrtransform/__main__.py | # SPDX-FileCopyrightText: 2023 James R. Barlow
# SPDX-License-Identifier: MIT
"""Simple CLI for testing HOCR."""
import argparse
from ocrmypdf.hocrtransform import HocrTransform
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Convert hocr file to PDF')
parser.add_argument(
'... | 1,130 | Python | .py | 35 | 26 | 82 | 0.643119 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,934 | _font.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/hocrtransform/_font.py | # SPDX-FileCopyrightText: 2023 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import logging
import unicodedata
import zlib
from importlib.resources import files as package_files
from pikepdf import (
Dictionary,
Name,
Pdf,
)
from pikepdf.canvas import Font
log = l... | 4,538 | Python | .py | 122 | 26.434426 | 88 | 0.571981 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,935 | __init__.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/hocrtransform/__init__.py | # SPDX-FileCopyrightText: 2023 James R. Barlow
# SPDX-License-Identifier: MIT
"""Transform .hocr and page image to text PDF."""
from __future__ import annotations
from ocrmypdf.hocrtransform._hocr import (
DebugRenderOptions,
HocrTransform,
HocrTransformError,
)
__all__ = (
'HocrTransform',
'Hoc... | 366 | Python | .py | 14 | 23.142857 | 49 | 0.741379 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,936 | _hocr.py | ocrmypdf_OCRmyPDF/src/ocrmypdf/hocrtransform/_hocr.py | # SPDX-FileCopyrightText: 2010 Jonathan Brinley
# SPDX-FileCopyrightText: 2013-2014 Julien Pfefferkorn
# SPDX-FileCopyrightText: 2023 James R. Barlow
# SPDX-License-Identifier: MIT
"""hOCR transform implementation."""
from __future__ import annotations
import logging
import os
import re
import unicodedata
from datac... | 18,088 | Python | .py | 447 | 29.706935 | 86 | 0.57207 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,937 | conf.py | ocrmypdf_OCRmyPDF/docs/conf.py | #!/usr/bin/env python3
# SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: CC-BY-SA-4.0
# ruff: noqa: E402
# ocrmypdf documentation build configuration file, created by
# sphinx-quickstart on Sun Sep 4 14:29:43 2016.
#
# This file is execfile()d with the current directory set to its
# containin... | 11,012 | Python | .py | 301 | 34.584718 | 88 | 0.714393 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,938 | conftest.py | ocrmypdf_OCRmyPDF/tests/conftest.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import platform
import sys
from pathlib import Path
from subprocess import CompletedProcess, run
import pytest
from ocrmypdf import api, pdfinfo
from ocrmypdf._exec import unpaper
from ocrmypdf._plug... | 4,825 | Python | .py | 122 | 34.606557 | 83 | 0.701547 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,939 | test_pdfa.py | ocrmypdf_OCRmyPDF/tests/test_pdfa.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import os
import pikepdf
import pytest
from ocrmypdf.exceptions import MissingDependencyError
from .conftest import check_ocrmypdf
@pytest.mark.parametrize('optimize', (0, 3))
@pytest.mark.paramet... | 1,274 | Python | .py | 33 | 31.666667 | 75 | 0.643958 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,940 | test_quality.py | ocrmypdf_OCRmyPDF/tests/test_quality.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
from ocrmypdf import quality as qual
def test_quality_measurement():
oqd = qual.OcrQualityDictionary(
wordlist=["words", "words", "quick", "brown", "fox", "dog", "lazy"]
)
assert ... | 630 | Python | .py | 15 | 37.133333 | 88 | 0.673235 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,941 | test_tagged.py | ocrmypdf_OCRmyPDF/tests/test_tagged.py | # SPDX-FileCopyrightText: 2023 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import pytest
import ocrmypdf
def test_block_tagged(resources):
with pytest.raises(ocrmypdf.exceptions.TaggedPDFError):
ocrmypdf.ocr(resources / 'tagged.pdf', '_.pdf')
def test_force_t... | 594 | Python | .py | 17 | 30 | 59 | 0.710526 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,942 | test_unpaper.py | ocrmypdf_OCRmyPDF/tests/test_unpaper.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import logging
from os import fspath
from unittest.mock import patch
import pytest
from packaging.version import Version
from ocrmypdf._exec import unpaper
from ocrmypdf._plugin_manager import get_pa... | 3,506 | Python | .py | 98 | 29.22449 | 82 | 0.660947 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,943 | test_api.py | ocrmypdf_OCRmyPDF/tests/test_api.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
from io import BytesIO
from pathlib import Path
import pytest
from pdfminer.high_level import extract_text
import ocrmypdf
import ocrmypdf.api
def test_language_list():
with pytest.raises(
... | 2,146 | Python | .py | 58 | 31.534483 | 88 | 0.669889 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,944 | test_hocrtransform.py | ocrmypdf_OCRmyPDF/tests/test_hocrtransform.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import re
from io import StringIO
import pytest
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfinterp i... | 2,909 | Python | .py | 76 | 32.960526 | 87 | 0.683256 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,945 | test_acroform.py | ocrmypdf_OCRmyPDF/tests/test_acroform.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import logging
import pikepdf
import pytest
import ocrmypdf
from .conftest import check_ocrmypdf
# pylint: disable=redefined-outer-name
@pytest.fixture
def acroform(resources):
return resourc... | 1,399 | Python | .py | 36 | 34.583333 | 88 | 0.748699 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,946 | test_stdio.py | ocrmypdf_OCRmyPDF/tests/test_stdio.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import os
from subprocess import DEVNULL, PIPE, run
import pytest
from ocrmypdf.helpers import check_pdf
from .conftest import run_ocrmypdf
def test_stdin(ocrmypdf_exec, resources, outpdf):
in... | 1,726 | Python | .py | 47 | 29.851064 | 81 | 0.638605 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,947 | test_helpers.py | ocrmypdf_OCRmyPDF/tests/test_helpers.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import logging
import multiprocessing
import os
from pathlib import Path
from unittest.mock import MagicMock
import pytest
from packaging.version import Version
from ocrmypdf import helpers
from .co... | 4,483 | Python | .py | 105 | 36.819048 | 83 | 0.680856 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,948 | test_completion.py | ocrmypdf_OCRmyPDF/tests/test_completion.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import os
from subprocess import run
import pytest
from .conftest import running_in_docker
pytestmark = pytest.mark.skipif(
running_in_docker(),
reason="docker can't complete",
)
def test_... | 1,071 | Python | .py | 36 | 23.277778 | 82 | 0.623782 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,949 | test_tesseract.py | ocrmypdf_OCRmyPDF/tests/test_tesseract.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import logging
import os
import subprocess
from os import fspath
from pathlib import Path
import pytest
from ocrmypdf import pdfinfo
from ocrmypdf._exec import tesseract
from ocrmypdf.exceptions impo... | 4,711 | Python | .py | 121 | 32.842975 | 88 | 0.665643 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,950 | test_main.py | ocrmypdf_OCRmyPDF/tests/test_main.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import os
import shutil
import sys
from math import isclose
from pathlib import Path
from subprocess import run
from unittest.mock import patch
import pikepdf
import pytest
from PIL import Image
impo... | 27,213 | Python | .py | 809 | 26.627936 | 118 | 0.620874 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,951 | test_metadata.py | ocrmypdf_OCRmyPDF/tests/test_metadata.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import datetime
import warnings
from datetime import timezone
from shutil import copyfile
import pikepdf
import pytest
from packaging.version import Version
from pikepdf.models.metadata import decode_... | 13,916 | Python | .py | 364 | 30.870879 | 88 | 0.628923 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,952 | __init__.py | ocrmypdf_OCRmyPDF/tests/__init__.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
"""Tests."""
from __future__ import annotations
| 132 | Python | .py | 4 | 31.5 | 46 | 0.753968 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,953 | test_graft.py | ocrmypdf_OCRmyPDF/tests/test_graft.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
from unittest.mock import patch
import pikepdf
import ocrmypdf
def test_no_glyphless_graft(resources, outdir):
with (
pikepdf.open(resources / 'francais.pdf') as pdf,
pikepdf.op... | 1,171 | Python | .py | 33 | 28.393939 | 88 | 0.632418 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,954 | test_logging.py | ocrmypdf_OCRmyPDF/tests/test_logging.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import logging
from ocrmypdf._pipelines._common import configure_debug_logging
def test_debug_logging(tmp_path):
# Just exercise the debug logger but don't validate it
# See https://github.c... | 571 | Python | .py | 13 | 40.384615 | 84 | 0.754069 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,955 | test_ghostscript.py | ocrmypdf_OCRmyPDF/tests/test_ghostscript.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import logging
import secrets
import subprocess
from decimal import Decimal
from unittest.mock import patch
import pikepdf
import pytest
from PIL import Image, UnidentifiedImageError
from ocrmypdf._e... | 7,097 | Python | .py | 174 | 33.41954 | 82 | 0.653695 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,956 | test_validation.py | ocrmypdf_OCRmyPDF/tests/test_validation.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import logging
import os
from unittest.mock import patch
import pikepdf
import pytest
from ocrmypdf import _validation as vd
from ocrmypdf._concurrent import NullProgressBar, SerialExecutor
from ocrm... | 9,490 | Python | .py | 244 | 31.836066 | 87 | 0.662277 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,957 | test_check_pdf.py | ocrmypdf_OCRmyPDF/tests/test_check_pdf.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
from ocrmypdf.helpers import check_pdf
def test_pdf_error(resources):
assert check_pdf(resources / 'blank.pdf')
assert not check_pdf(__file__)
| 272 | Python | .py | 7 | 36.142857 | 46 | 0.762452 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,958 | test_soft_error.py | ocrmypdf_OCRmyPDF/tests/test_soft_error.py | # SPDX-FileCopyrightText: 2023 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import os
import pytest
from ocrmypdf.exceptions import ExitCode
from .conftest import run_ocrmypdf_api
def test_raster_continue_on_soft_error(resources, outpdf):
exitcode = run_ocrmypdf_api(
... | 1,695 | Python | .py | 50 | 27.52 | 80 | 0.652574 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,959 | test_pipeline.py | ocrmypdf_OCRmyPDF/tests/test_pipeline.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import warnings
from unittest.mock import Mock
import pytest
from PIL import Image
from reportlab.lib.units import inch
from reportlab.lib.utils import ImageReader
from reportlab.pdfgen.canvas import ... | 4,020 | Python | .py | 137 | 20.029197 | 84 | 0.455533 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,960 | test_semfree.py | ocrmypdf_OCRmyPDF/tests/test_semfree.py | # SPDX-FileCopyrightText: 2023 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import pytest
from ocrmypdf.exceptions import ExitCode
from .conftest import is_linux, run_ocrmypdf_api
@pytest.mark.skipif(not is_linux(), reason='semfree plugin only works on Linux')
def test_sem... | 690 | Python | .py | 20 | 29 | 80 | 0.680723 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,961 | test_userunit.py | ocrmypdf_OCRmyPDF/tests/test_userunit.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
from math import isclose
import pytest
from ocrmypdf.pdfinfo import PdfInfo
from .conftest import check_ocrmypdf
# pylint: disable=redefined-outer-name
@pytest.fixture
def poster(resources):
... | 959 | Python | .py | 32 | 24.8125 | 65 | 0.680525 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,962 | test_image_input.py | ocrmypdf_OCRmyPDF/tests/test_image_input.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
from unittest.mock import patch
import img2pdf
import pikepdf
import pytest
from PIL import Image
import ocrmypdf
from .conftest import check_ocrmypdf, run_ocrmypdf_api
# pylint: disable=redefined-... | 2,415 | Python | .py | 67 | 30.537313 | 88 | 0.677988 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,963 | test_rotation.py | ocrmypdf_OCRmyPDF/tests/test_rotation.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import operator
from io import BytesIO
from math import cos, pi, sin
from os import fspath
from subprocess import run
import img2pdf
import pikepdf
import pytest
from PIL import Image, ImageChops
from... | 10,802 | Python | .py | 304 | 28.388158 | 86 | 0.623779 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,964 | test_optimize.py | ocrmypdf_OCRmyPDF/tests/test_optimize.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
from io import BytesIO
from os import fspath
from pathlib import Path
from unittest.mock import MagicMock, patch
import img2pdf
import pikepdf
import pytest
from pikepdf import Array, Dictionary, Name... | 8,853 | Python | .py | 264 | 27.19697 | 78 | 0.635724 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,965 | test_page_numbers.py | ocrmypdf_OCRmyPDF/tests/test_page_numbers.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import pytest
import ocrmypdf
from ocrmypdf._validation import _pages_from_ranges
from ocrmypdf.exceptions import BadArgsError
from ocrmypdf.pdfinfo import PdfInfo
@pytest.mark.parametrize(
'pag... | 1,618 | Python | .py | 54 | 23.685185 | 53 | 0.569775 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,966 | test_concurrency.py | ocrmypdf_OCRmyPDF/tests/test_concurrency.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import os
import platform
import pytest
from ocrmypdf import ExitCode
from .conftest import run_ocrmypdf_api
@pytest.mark.skipif(os.name == 'nt', reason="Windows doesn't have SIGKILL")
@pytest.mar... | 728 | Python | .py | 22 | 28.863636 | 85 | 0.703863 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,967 | test_preprocessing.py | ocrmypdf_OCRmyPDF/tests/test_preprocessing.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
from math import isclose
import pytest
from PIL import Image
from ocrmypdf._exec import ghostscript, tesseract
from ocrmypdf.exceptions import ExitCode
from ocrmypdf.helpers import Resolution
from oc... | 4,980 | Python | .py | 128 | 33.007813 | 84 | 0.660785 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,968 | test_pdfinfo.py | ocrmypdf_OCRmyPDF/tests/test_pdfinfo.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import pickle
import warnings
from io import BytesIO
from math import isclose
import img2pdf
import pikepdf
import pytest
from PIL import Image
from reportlab.lib.units import inch
from reportlab.pdfg... | 6,513 | Python | .py | 180 | 30.905556 | 79 | 0.689683 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,969 | test_imageops.py | ocrmypdf_OCRmyPDF/tests/test_imageops.py | # SPDX-FileCopyrightText: 2023 James R. Barlow
# SPDX-License-Identifier: MPL-2.0
from __future__ import annotations
import hypothesis.strategies as st
from hypothesis import given
from PIL import Image
from ocrmypdf.imageops import (
_calculate_downsample,
bytes_per_pixel,
calculate_downsample,
down... | 1,748 | Python | .py | 47 | 32.808511 | 84 | 0.663905 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,970 | gs_raster_soft_error.py | ocrmypdf_OCRmyPDF/tests/plugins/gs_raster_soft_error.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MIT
from __future__ import annotations
from pathlib import Path
from subprocess import CalledProcessError
from unittest.mock import patch
from ocrmypdf import hookimpl
from ocrmypdf.builtin_plugins import ghostscript
from ocrmypdf.subprocess i... | 1,260 | Python | .py | 40 | 25.225 | 82 | 0.680956 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,971 | gs_feature_elision.py | ocrmypdf_OCRmyPDF/tests/plugins/gs_feature_elision.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MIT
from __future__ import annotations
from unittest.mock import patch
from ocrmypdf import hookimpl
from ocrmypdf.builtin_plugins import ghostscript
from ocrmypdf.subprocess import run_polling_stderr
ELISION_WARNING = """GPL Ghostscript 9.50... | 1,144 | Python | .py | 29 | 33.068966 | 84 | 0.693767 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,972 | gs_render_failure.py | ocrmypdf_OCRmyPDF/tests/plugins/gs_render_failure.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MIT
from __future__ import annotations
from subprocess import CalledProcessError
from unittest.mock import patch
from ocrmypdf import hookimpl
from ocrmypdf.builtin_plugins import ghostscript
def raise_gs_fail(*args, **kwargs):
raise Cal... | 998 | Python | .py | 27 | 29.925926 | 84 | 0.682573 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,973 | gs_raster_failure.py | ocrmypdf_OCRmyPDF/tests/plugins/gs_raster_failure.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MIT
from __future__ import annotations
from pathlib import Path
from subprocess import CalledProcessError
from unittest.mock import patch
from ocrmypdf import hookimpl
from ocrmypdf.builtin_plugins import ghostscript
def raise_gs_fail(*args,... | 1,150 | Python | .py | 38 | 23.815789 | 71 | 0.669683 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,974 | tesseract_crash.py | ocrmypdf_OCRmyPDF/tests/plugins/tesseract_crash.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MIT
from __future__ import annotations
import signal
from contextlib import contextmanager
from subprocess import CalledProcessError
from unittest.mock import patch
from ocrmypdf import hookimpl
from ocrmypdf.builtin_plugins.tesseract_ocr impor... | 1,563 | Python | .py | 43 | 29.953488 | 79 | 0.702255 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,975 | tesseract_noop.py | ocrmypdf_OCRmyPDF/tests/plugins/tesseract_noop.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MIT
"""Tesseract no-op plugin.
To quickly run tests where getting OCR output is not necessary.
In 'hocr' mode, create a .hocr file that specifies no text found.
In 'pdf' mode, convert the image to PDF using another program.
In orientation che... | 2,934 | Python | .py | 77 | 32.558442 | 87 | 0.641297 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,976 | gs_render_soft_error.py | ocrmypdf_OCRmyPDF/tests/plugins/gs_render_soft_error.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MIT
from __future__ import annotations
from subprocess import CalledProcessError
from unittest.mock import patch
from ocrmypdf import hookimpl
from ocrmypdf.builtin_plugins import ghostscript
from ocrmypdf.subprocess import run_polling_stderr
... | 1,181 | Python | .py | 36 | 26.5 | 82 | 0.688049 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,977 | tesseract_cache.py | ocrmypdf_OCRmyPDF/tests/plugins/tesseract_cache.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MIT
"""Cache output of tesseract to speed up test suite.
The cache is keyed by by the input test file The input arguments are slugged
into a hideous filename that more or less represents them literally. Joined
together, this becomes the name of... | 7,228 | Python | .py | 169 | 35.852071 | 84 | 0.664055 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,978 | tesseract_badutf8.py | ocrmypdf_OCRmyPDF/tests/plugins/tesseract_badutf8.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MIT
"""Tesseract bad utf8.
In some cases, some versions of Tesseract can output binary gibberish or data
that is not UTF-8 compatible, so we are forced to check that we can convert it
and present it to the user.
"""
from __future__ import anno... | 1,527 | Python | .py | 42 | 30.642857 | 84 | 0.710401 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,979 | gs_pdfa_failure.py | ocrmypdf_OCRmyPDF/tests/plugins/gs_pdfa_failure.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MIT
from __future__ import annotations
from unittest.mock import patch
from ocrmypdf import hookimpl
from ocrmypdf.builtin_plugins import ghostscript
from ocrmypdf.subprocess import run_polling_stderr
def run_rig_args(args, **kwargs):
# ... | 1,251 | Python | .py | 32 | 32.375 | 87 | 0.688119 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,980 | tesseract_simulate_oom_killer.py | ocrmypdf_OCRmyPDF/tests/plugins/tesseract_simulate_oom_killer.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MIT
"""Tesseract no-op plugin that simulates the OOM killer on page 4.
OCRmyPDF can use a lot of memory, even that it might trigger the
OOM killer on Linux or similar features on other platforms. We want to
ensure we fail with an error rather th... | 1,943 | Python | .py | 51 | 32.784314 | 82 | 0.704691 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,981 | tesseract_big_image_error.py | ocrmypdf_OCRmyPDF/tests/plugins/tesseract_big_image_error.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MIT
from __future__ import annotations
from contextlib import contextmanager
from subprocess import CalledProcessError
from unittest.mock import patch
from ocrmypdf import hookimpl
from ocrmypdf.builtin_plugins.tesseract_ocr import TesseractOcr... | 1,516 | Python | .py | 41 | 30.512195 | 76 | 0.708134 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,982 | tesseract_debug_rotate.py | ocrmypdf_OCRmyPDF/tests/plugins/tesseract_debug_rotate.py | # SPDX-FileCopyrightText: 2022 James R. Barlow
# SPDX-License-Identifier: MIT
"""Tesseract no-op/fixed rotate plugin.
To quickly run tests where getting OCR output is not necessary and we want to test
the rotation pipeline.
In 'hocr' mode, create a .hocr file that specifies no text found.
In 'pdf' mode, convert the ... | 3,094 | Python | .py | 78 | 34.166667 | 87 | 0.648198 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,983 | example_plugin.py | ocrmypdf_OCRmyPDF/misc/example_plugin.py | # SPDX-FileCopyrightText: 2022 James R Barlow: https://github.com/jbarlow83
# SPDX-License-Identifier: MIT
"""An example of an OCRmyPDF plugin.
This plugin adds two new command line arguments
--grayscale-ocr: converts the image to grayscale before performing OCR on it
(This is occasionally useful for imag... | 1,732 | Python | .py | 49 | 30.44898 | 82 | 0.710337 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,984 | webservice.py | ocrmypdf_OCRmyPDF/misc/webservice.py | #!/usr/bin/env python3
# SPDX-FileCopyrightText: 2019 James R. Barlow
# SPDX-License-Identifier: AGPL-3.0-or-later
"""This is a simple web service/HTTP wrapper for OCRmyPDF.
This may be more convenient than the command line tool for some Docker users.
Note that OCRmyPDF uses Ghostscript, which is licensed under AGPLv... | 3,902 | Python | .py | 86 | 40.476744 | 87 | 0.707246 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,985 | synology.py | ocrmypdf_OCRmyPDF/misc/synology.py | #!/bin/env python3
# SPDX-FileCopyrightText: 2017 Enantiomerie
# SPDX-License-Identifier: MIT
"""Example OCRmyPDF for Synology NAS."""
from __future__ import annotations
# This script must be edited to meet your needs.
import logging
import os
import shutil
import subprocess
import sys
import time
# pylint: disable... | 2,265 | Python | .py | 69 | 25.115942 | 60 | 0.589767 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,986 | batch.py | ocrmypdf_OCRmyPDF/misc/batch.py | #!/usr/bin/env python3
# SPDX-FileCopyrightText: 2016 findingorder <https://github.com/findingorder>
# SPDX-FileCopyrightText: 2024 nilsro <https://github.com/nilsro>
# SPDX-License-Identifier: MIT
"""Example of using ocrmypdf as a library in a script.
This script will recursively search a directory for PDF files and... | 2,973 | Python | .py | 74 | 34.297297 | 87 | 0.707842 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,987 | watcher.py | ocrmypdf_OCRmyPDF/misc/watcher.py | #!/usr/bin/env python3
# SPDX-FileCopyrightText: 2019 Ian Alexander <https://github.com/ianalexander>
# SPDX-FileCopyrightText: 2020 James R Barlow <https://github.com/jbarlow83>
# SPDX-License-Identifier: MIT
"""Watch a directory for new PDFs and OCR them."""
# Do not enable annotations!
# https://github.com/tiangol... | 10,189 | Python | .py | 304 | 25.555921 | 87 | 0.609155 | ocrmypdf/OCRmyPDF | 13,520 | 989 | 109 | MPL-2.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,988 | source_firefox.py | fossasia_meilix/meilix-default-settings-old/usr/share/apport/package-hooks/source_firefox.py | '''firefox apport hook
/usr/share/apport/package-hooks/firefox.py
Copyright (c) 2007: Hilario J. Montoliu <hmontoliu@gmail.com>
(c) 2011: Chris Coulson <chris.coulson@canonical.com>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as ... | 53,946 | Python | .py | 1,257 | 30.424025 | 151 | 0.540523 | fossasia/meilix | 1,772 | 213 | 33 | LGPL-3.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,989 | folder-copyapp.svg | fossasia_meilix/meilix-default-settings-old/usr/share/icons/meilix/places/16/folder-copyapp.svg | <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns... | 3,687 | Python | .py | 122 | 24 | 473 | 0.618126 | fossasia/meilix | 1,772 | 213 | 33 | LGPL-3.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,990 | edit-copy.svg | fossasia_meilix/meilix-default-settings-old/usr/share/icons/meilix/actions/24/edit-copy.svg | <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns... | 4,400 | Python | .py | 122 | 29.819672 | 549 | 0.656769 | fossasia/meilix | 1,772 | 213 | 33 | LGPL-3.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,991 | media-optical-copy.svg | fossasia_meilix/meilix-default-settings-old/usr/share/icons/meilix/actions/24/media-optical-copy.svg | <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns... | 4,877 | Python | .py | 122 | 33.729508 | 982 | 0.641986 | fossasia/meilix | 1,772 | 213 | 33 | LGPL-3.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,992 | edit-copy.svg | fossasia_meilix/meilix-default-settings-old/usr/share/icons/meilix/actions/22/edit-copy.svg | <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns... | 4,362 | Python | .py | 119 | 30.411765 | 549 | 0.656058 | fossasia/meilix | 1,772 | 213 | 33 | LGPL-3.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,993 | media-optical-copy.svg | fossasia_meilix/meilix-default-settings-old/usr/share/icons/meilix/actions/22/media-optical-copy.svg | <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns... | 4,752 | Python | .py | 115 | 35.113043 | 1,060 | 0.647541 | fossasia/meilix | 1,772 | 213 | 33 | LGPL-3.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,994 | copyright | fossasia_meilix/meilix-default-settings-old/usr/share/doc/firefox/copyright | This package was debianized by Eric Dorland <eric@debian.org> on
Thu, 05 Jun 2003 01:01:22 -0400
It was downloaded from http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/
The source tarball is an aggregate of several different works in which the
main one, developed by the Mozilla Project, is firefox.
Other wor... | 34,969 | Python | .py | 578 | 56.603806 | 86 | 0.789188 | fossasia/meilix | 1,772 | 213 | 33 | LGPL-3.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,995 | copyright | fossasia_meilix/meilix-default-settings-old/debian/copyright | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: plymouth-meilix-logo
Source: <url://example.com>
Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: <special license>
<Put the license of the package here inde... | 1,680 | Python | .py | 35 | 46.028571 | 77 | 0.782582 | fossasia/meilix | 1,772 | 213 | 33 | LGPL-3.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,996 | source_firefox.py | fossasia_meilix/meilix-default-settings/usr/share/apport/package-hooks/source_firefox.py | '''firefox apport hook
/usr/share/apport/package-hooks/firefox.py
Copyright (c) 2007: Hilario J. Montoliu <hmontoliu@gmail.com>
(c) 2011: Chris Coulson <chris.coulson@canonical.com>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as ... | 53,946 | Python | .py | 1,257 | 30.424025 | 151 | 0.540523 | fossasia/meilix | 1,772 | 213 | 33 | LGPL-3.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,997 | copyright | fossasia_meilix/meilix-default-settings/usr/share/doc/firefox/copyright | This package was debianized by Eric Dorland <eric@debian.org> on
Thu, 05 Jun 2003 01:01:22 -0400
It was downloaded from http://ftp.mozilla.org/pub/mozilla.org/firefox/releases/
The source tarball is an aggregate of several different works in which the
main one, developed by the Mozilla Project, is firefox.
Other wor... | 34,969 | Python | .py | 578 | 56.603806 | 86 | 0.789188 | fossasia/meilix | 1,772 | 213 | 33 | LGPL-3.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,998 | copyright | fossasia_meilix/meilix-default-settings/debian/copyright | Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: plymouth-meilix-logo
Source: <url://example.com>
Files: *
Copyright: <years> <put author's name and email here>
<years> <likewise for another author>
License: <special license>
<Put the license of the package here inde... | 1,680 | Python | .py | 35 | 46.028571 | 77 | 0.782582 | fossasia/meilix | 1,772 | 213 | 33 | LGPL-3.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |
32,999 | mail-fail.py | fossasia_meilix/scripts/mail-scripts/mail-fail.py | #! /usr/bin/env python3
import http.client
import os
import datetime
import base64
#attachment encoding
with open('../../log.txt','rb') as f:
data = f.read()
f.close()
attachment = base64.b64encode(data)
conn = http.client.HTTPSConnection("api.sendgrid.com")
print (os.environ["email"])
payload = "{\"persona... | 1,208 | Python | .py | 23 | 50.217391 | 605 | 0.651064 | fossasia/meilix | 1,772 | 213 | 33 | LGPL-3.0 | 9/5/2024, 5:14:46 PM (Europe/Amsterdam) |