mirror of
https://github.com/ocrmypdf/OCRmyPDF.git
synced 2026-01-06 12:11:18 +00:00
Sort imports
This commit is contained in:
parent
8c5f8b8ddd
commit
c5edff2c2f
@ -41,7 +41,7 @@ from .helpers import safe_symlink
|
||||
from .hocrtransform import HocrTransform
|
||||
from .optimize import optimize
|
||||
from .pdfa import generate_pdfa_ps
|
||||
from .pdfinfo import Colorspace, PdfInfo, Encoding
|
||||
from .pdfinfo import Colorspace, Encoding, PdfInfo
|
||||
|
||||
VECTOR_PAGE_DPI = 400
|
||||
|
||||
|
||||
@ -25,8 +25,8 @@ import threading
|
||||
from collections import namedtuple
|
||||
from tempfile import mkdtemp
|
||||
|
||||
from tqdm import tqdm
|
||||
import PIL
|
||||
from tqdm import tqdm
|
||||
|
||||
from ._graft import OcrGrafter
|
||||
from ._jobcontext import PDFContext, cleanup_working_files, make_logger
|
||||
|
||||
@ -21,7 +21,7 @@ import sys
|
||||
import warnings
|
||||
from enum import IntEnum
|
||||
from pathlib import Path
|
||||
from typing import List, Optional, Dict
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from tqdm import tqdm
|
||||
|
||||
|
||||
@ -20,11 +20,12 @@
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import shutil
|
||||
import sys
|
||||
from collections.abc import Mapping
|
||||
from functools import lru_cache
|
||||
from subprocess import PIPE, STDOUT, CalledProcessError, run as subprocess_run
|
||||
from subprocess import PIPE, STDOUT, CalledProcessError
|
||||
from subprocess import run as subprocess_run
|
||||
|
||||
from ..exceptions import ExitCode, MissingDependencyError
|
||||
|
||||
|
||||
@ -18,20 +18,20 @@
|
||||
"""Interface to Ghostscript executable"""
|
||||
|
||||
import logging
|
||||
import re
|
||||
import os
|
||||
import re
|
||||
import warnings
|
||||
from contextlib import suppress
|
||||
from functools import lru_cache
|
||||
from io import BytesIO
|
||||
from os import fspath
|
||||
from pathlib import Path
|
||||
from subprocess import PIPE, CalledProcessError
|
||||
from shutil import which
|
||||
from subprocess import PIPE, CalledProcessError
|
||||
|
||||
from PIL import Image
|
||||
|
||||
from ..exceptions import SubprocessOutputError, MissingDependencyError
|
||||
from ..exceptions import MissingDependencyError, SubprocessOutputError
|
||||
from . import get_version, run
|
||||
|
||||
gslog = logging.getLogger()
|
||||
|
||||
@ -17,11 +17,11 @@
|
||||
|
||||
"""Interface to Tesseract executable"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
from collections import namedtuple
|
||||
from contextlib import suppress
|
||||
import logging
|
||||
from os import fspath
|
||||
from subprocess import PIPE, STDOUT, CalledProcessError, TimeoutExpired
|
||||
|
||||
|
||||
@ -29,7 +29,8 @@ from tempfile import TemporaryDirectory
|
||||
from PIL import Image
|
||||
|
||||
from ..exceptions import MissingDependencyError, SubprocessOutputError
|
||||
from . import get_version, run as external_run
|
||||
from . import get_version
|
||||
from . import run as external_run
|
||||
|
||||
|
||||
@lru_cache(maxsize=1)
|
||||
|
||||
@ -33,9 +33,9 @@ from io import BytesIO
|
||||
from os import fspath
|
||||
from tempfile import TemporaryFile
|
||||
|
||||
from .lib._leptonica import ffi
|
||||
from .exceptions import MissingDependencyError
|
||||
from .exec import shim_paths_with_program_files
|
||||
from .lib._leptonica import ffi
|
||||
|
||||
# pylint: disable=protected-access
|
||||
|
||||
|
||||
@ -21,10 +21,11 @@ import platform
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from subprocess import PIPE, run
|
||||
from ocrmypdf import api, cli
|
||||
|
||||
import pytest
|
||||
|
||||
from ocrmypdf import api, cli
|
||||
|
||||
pytest_plugins = ['helpers_namespace']
|
||||
|
||||
try:
|
||||
|
||||
@ -25,14 +25,12 @@ import os
|
||||
import sys
|
||||
from subprocess import check_call
|
||||
|
||||
from gs import real_ghostscript
|
||||
|
||||
"""Replicate one type of Ghostscript feature elision warning during
|
||||
PDF/A creation."""
|
||||
|
||||
|
||||
from gs import real_ghostscript
|
||||
|
||||
|
||||
elision_warning = """GPL Ghostscript 9.20: Setting Overprint Mode to 1
|
||||
not permitted in PDF/A-2, overprint mode not set"""
|
||||
|
||||
|
||||
@ -23,12 +23,12 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
from gs import real_ghostscript
|
||||
|
||||
|
||||
"""Replicate Ghostscript PDF/A conversion failure by suppressing some
|
||||
arguments"""
|
||||
|
||||
from gs import real_ghostscript
|
||||
|
||||
|
||||
def main():
|
||||
if '--version' in sys.argv:
|
||||
|
||||
@ -24,11 +24,10 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
"""Replicate Ghostscript raster failure while allowing rendering"""
|
||||
|
||||
|
||||
from gs import real_ghostscript
|
||||
|
||||
"""Replicate Ghostscript raster failure while allowing rendering"""
|
||||
|
||||
|
||||
def main():
|
||||
if '--version' in sys.argv:
|
||||
|
||||
@ -25,7 +25,6 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
from gs import real_ghostscript
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,6 @@
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
"""Tesseract bad utf8 spoof
|
||||
|
||||
In 'hocr' mode or 'pdf' mode, return error code 1 and some non-Unicode
|
||||
|
||||
@ -59,7 +59,6 @@ import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
__version__ = subprocess.check_output(
|
||||
['tesseract', '--version'], stderr=subprocess.STDOUT
|
||||
).decode()
|
||||
|
||||
@ -19,7 +19,6 @@ import pytest
|
||||
|
||||
import ocrmypdf
|
||||
|
||||
|
||||
check_ocrmypdf = pytest.helpers.check_ocrmypdf
|
||||
|
||||
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from subprocess import run, PIPE
|
||||
from subprocess import PIPE, run
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@ -18,7 +18,6 @@
|
||||
import logging
|
||||
from decimal import Decimal
|
||||
|
||||
|
||||
import pikepdf
|
||||
import pytest
|
||||
from PIL import Image
|
||||
|
||||
@ -18,10 +18,10 @@
|
||||
import os
|
||||
from unittest.mock import patch
|
||||
|
||||
import pikepdf
|
||||
import pytest
|
||||
|
||||
import ocrmypdf
|
||||
import pikepdf
|
||||
|
||||
|
||||
def test_no_glyphless_graft(resources, outdir):
|
||||
|
||||
@ -17,10 +17,10 @@
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
from PIL import Image
|
||||
import img2pdf
|
||||
import pikepdf
|
||||
import pytest
|
||||
from PIL import Image
|
||||
|
||||
import ocrmypdf
|
||||
|
||||
|
||||
@ -16,8 +16,8 @@
|
||||
# along with OCRmyPDF. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from os import fspath
|
||||
import os
|
||||
from os import fspath
|
||||
from pickle import dumps, loads
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
@ -17,22 +17,22 @@
|
||||
|
||||
|
||||
import datetime
|
||||
from datetime import timezone
|
||||
import logging
|
||||
import mmap
|
||||
from os import fspath
|
||||
import os
|
||||
from datetime import timezone
|
||||
from os import fspath
|
||||
from pathlib import Path
|
||||
from shutil import copyfile, move
|
||||
from unittest.mock import MagicMock, patch
|
||||
|
||||
import pytest
|
||||
|
||||
import pikepdf
|
||||
import pytest
|
||||
from pikepdf.models.metadata import decode_pdf_date
|
||||
|
||||
from ocrmypdf._jobcontext import PDFContext
|
||||
from ocrmypdf.exceptions import ExitCode
|
||||
from ocrmypdf.pdfa import SRGB_ICC_PROFILE, file_claims_pdfa, generate_pdfa_ps
|
||||
from pikepdf.models.metadata import decode_pdf_date
|
||||
|
||||
try:
|
||||
import fitz
|
||||
|
||||
@ -19,10 +19,10 @@ import logging
|
||||
from os import fspath
|
||||
from pathlib import Path
|
||||
|
||||
import pikepdf
|
||||
import pytest
|
||||
from PIL import Image
|
||||
|
||||
import pikepdf
|
||||
from ocrmypdf import optimize as opt
|
||||
from ocrmypdf.exec import jbig2enc, pngquant
|
||||
from ocrmypdf.exec.ghostscript import rasterize_pdf
|
||||
|
||||
@ -19,8 +19,8 @@ import pytest
|
||||
|
||||
import ocrmypdf
|
||||
from ocrmypdf._validation import _pages_from_ranges
|
||||
from ocrmypdf.pdfinfo import PdfInfo
|
||||
from ocrmypdf.exceptions import BadArgsError
|
||||
from ocrmypdf.pdfinfo import PdfInfo
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
|
||||
@ -20,11 +20,11 @@ from math import isclose
|
||||
from tempfile import NamedTemporaryFile
|
||||
|
||||
import img2pdf
|
||||
import pikepdf
|
||||
import pytest
|
||||
from PIL import Image
|
||||
from reportlab.pdfgen.canvas import Canvas
|
||||
|
||||
import pikepdf
|
||||
from ocrmypdf import pdfinfo
|
||||
from ocrmypdf.pdfinfo import Colorspace, Encoding
|
||||
|
||||
|
||||
@ -21,10 +21,10 @@ from os import fspath
|
||||
from unittest.mock import Mock
|
||||
|
||||
import img2pdf
|
||||
import pikepdf
|
||||
import pytest
|
||||
from PIL import Image
|
||||
|
||||
import pikepdf
|
||||
from ocrmypdf import leptonica
|
||||
from ocrmypdf.exec import ghostscript, tesseract
|
||||
from ocrmypdf.pdfinfo import PdfInfo
|
||||
|
||||
@ -18,7 +18,7 @@
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from subprocess import DEVNULL, PIPE, run, Popen, CalledProcessError
|
||||
from subprocess import DEVNULL, PIPE, CalledProcessError, Popen, run
|
||||
|
||||
import pytest
|
||||
|
||||
|
||||
@ -20,8 +20,8 @@ from unittest.mock import patch
|
||||
|
||||
import pytest
|
||||
|
||||
from ocrmypdf.cli import parser
|
||||
from ocrmypdf._validation import check_options
|
||||
from ocrmypdf.cli import parser
|
||||
from ocrmypdf.exceptions import ExitCode, MissingDependencyError
|
||||
from ocrmypdf.exec import unpaper
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ import pytest
|
||||
|
||||
import ocrmypdf._validation as vd
|
||||
from ocrmypdf.api import create_options
|
||||
from ocrmypdf.exceptions import MissingDependencyError, BadArgsError
|
||||
from ocrmypdf.exceptions import BadArgsError, MissingDependencyError
|
||||
from ocrmypdf.pdfinfo import PdfInfo
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user