rename ocrmypdf.run -> ocrmypdf.ocr
This commit is contained in:
+3
-3
@@ -20,7 +20,7 @@ and largely have the same functions.
|
||||
|
||||
import ocrmypdf
|
||||
|
||||
ocrmypdf.run('input.pdf', 'output.pdf', deskew=True)
|
||||
ocrmypdf.ocr('input.pdf', 'output.pdf', deskew=True)
|
||||
|
||||
With a few exceptions, all of the command line arguments are available
|
||||
and may be passed as equivalent keywords.
|
||||
@@ -37,7 +37,7 @@ worker processes (forking itself) - manage the signal flags of worker
|
||||
processes 0 execute other subprocesses (forking and executing other
|
||||
programs)
|
||||
|
||||
The Python process that calls ``ocrmypdf.run()`` must be sufficiently
|
||||
The Python process that calls ``ocrmypdf.ocr()`` must be sufficiently
|
||||
privileged to perform these actions. If it is not, ``ocrmypdf()`` will
|
||||
fail.
|
||||
|
||||
@@ -45,7 +45,7 @@ There is no currently no option to manage how jobs are scheduled other
|
||||
than the argument ``jobs=`` which will limit the number of worker
|
||||
processes.
|
||||
|
||||
Forking a child process to call ``ocrmypdf.run()`` is suggested. That
|
||||
Forking a child process to call ``ocrmypdf.ocr()`` is suggested. That
|
||||
way your application will survive and remain interactive even if
|
||||
OCRmyPDF does not.
|
||||
|
||||
|
||||
@@ -44,4 +44,4 @@ from . import hocrtransform
|
||||
from . import leptonica
|
||||
from . import pdfa
|
||||
from . import pdfinfo
|
||||
from .api import run, configure_logging, Verbosity
|
||||
from .api import ocr, configure_logging, Verbosity
|
||||
|
||||
+1
-1
@@ -158,7 +158,7 @@ def create_options(*, input_file, output_file, **kwargs):
|
||||
return options
|
||||
|
||||
|
||||
def run( # pylint: disable=unused-argument
|
||||
def ocr( # pylint: disable=unused-argument
|
||||
input_file,
|
||||
output_file,
|
||||
*,
|
||||
|
||||
@@ -80,7 +80,7 @@ def test_filter_from_cmdline(resources, outdir):
|
||||
|
||||
|
||||
def test_filter_from_api(resources, outdir):
|
||||
ocrmypdf.run(
|
||||
ocrmypdf.ocr(
|
||||
resources / 'crom.png',
|
||||
outdir / 'out.pdf',
|
||||
image_dpi=100,
|
||||
|
||||
+2
-2
@@ -36,14 +36,14 @@ def test_no_glyphless_graft(resources, outdir):
|
||||
env = os.environ.copy()
|
||||
env['_OCRMYPDF_MAX_REPLACE_PAGES'] = '2'
|
||||
with os_environ(env):
|
||||
ocrmypdf.run(
|
||||
ocrmypdf.ocr(
|
||||
outdir / 'test.pdf', outdir / 'out.pdf', deskew=True, tesseract_timeout=0
|
||||
)
|
||||
|
||||
|
||||
@pytest.helpers.needs_pdfminer
|
||||
def test_links(resources, outpdf):
|
||||
ocrmypdf.run(
|
||||
ocrmypdf.ocr(
|
||||
resources / 'link.pdf', outpdf, redo_ocr=True, oversample=200, output_type='pdf'
|
||||
)
|
||||
pdf = pikepdf.open(outpdf)
|
||||
|
||||
+1
-1
@@ -614,7 +614,7 @@ def test_closed_streams(spoof_tesseract_noop, ocrmypdf_exec, resources, outpdf):
|
||||
|
||||
def test_masks(spoof_tesseract_noop, resources, outpdf):
|
||||
assert (
|
||||
ocrmypdf.run(
|
||||
ocrmypdf.ocr(
|
||||
resources / 'masks.pdf', outpdf, tesseract_env=spoof_tesseract_noop
|
||||
)
|
||||
== ExitCode.ok
|
||||
|
||||
@@ -42,7 +42,7 @@ def test_list_range():
|
||||
|
||||
def test_limited_pages(resources, outpdf, spoof_tesseract_cache):
|
||||
multi = resources / 'multipage.pdf'
|
||||
ocrmypdf.run(
|
||||
ocrmypdf.ocr(
|
||||
multi,
|
||||
outpdf,
|
||||
pages='5-6',
|
||||
|
||||
Reference in New Issue
Block a user