Rename ocrmypdf.exec -> ocrmypdf._exec

This commit is contained in:
James R. Barlow
2020-06-09 14:59:09 -07:00
parent be8ca589d4
commit 0f942fb714
30 changed files with 41 additions and 41 deletions
+1 -1
View File
@@ -37,7 +37,7 @@ def run_append_stderr(*args, **kwargs):
@hookimpl
def generate_pdfa(pdf_pages, pdfmark, output_file, compression, pdf_version, pdfa_part):
with patch('ocrmypdf.exec.ghostscript.run', new=run_append_stderr):
with patch('ocrmypdf._exec.ghostscript.run', new=run_append_stderr):
ghostscript.generate_pdfa(
pdf_pages=pdf_pages,
pdfmark=pdfmark,
+1 -1
View File
@@ -39,7 +39,7 @@ def run_rig_args(args, **kwargs):
@hookimpl
def generate_pdfa(pdf_pages, pdfmark, output_file, compression, pdf_version, pdfa_part):
with patch('ocrmypdf.exec.ghostscript.run', new=run_rig_args):
with patch('ocrmypdf._exec.ghostscript.run', new=run_rig_args):
ghostscript.generate_pdfa(
pdf_pages=pdf_pages,
pdfmark=pdfmark,
+1 -1
View File
@@ -45,7 +45,7 @@ def rasterize_pdf_page(
rotation=None,
filter_vector=False,
) -> Path:
with patch('ocrmypdf.exec.ghostscript.run', new=raise_gs_fail):
with patch('ocrmypdf._exec.ghostscript.run', new=raise_gs_fail):
ghostscript.rasterize_pdf_page(
input_file=input_file,
output_file=output_file,
+1 -1
View File
@@ -36,7 +36,7 @@ def raise_gs_fail(*args, **kwargs):
@hookimpl
def generate_pdfa(pdf_pages, pdfmark, output_file, compression, pdf_version, pdfa_part):
with patch('ocrmypdf.exec.ghostscript.run', new=raise_gs_fail):
with patch('ocrmypdf._exec.ghostscript.run', new=raise_gs_fail):
ghostscript.generate_pdfa(
pdf_pages=pdf_pages,
pdfmark=pdfmark,
+2 -2
View File
@@ -45,14 +45,14 @@ def bad_utf8(*args, **kwargs):
class BadUtf8OcrEngine(TesseractOcrEngine):
@staticmethod
def generate_hocr(input_file, output_hocr, output_text, options):
with patch('ocrmypdf.exec.tesseract.run', new=bad_utf8):
with patch('ocrmypdf._exec.tesseract.run', new=bad_utf8):
TesseractOcrEngine.generate_hocr(
input_file, output_hocr, output_text, options
)
@staticmethod
def generate_pdf(input_file, output_pdf, output_text, options):
with patch('ocrmypdf.exec.tesseract.run', new=bad_utf8):
with patch('ocrmypdf._exec.tesseract.run', new=bad_utf8):
TesseractOcrEngine.generate_pdf(
input_file, output_pdf, output_text, options
)
+3 -3
View File
@@ -38,19 +38,19 @@ def raise_size_exception(*args, **kwargs):
class BigImageErrorOcrEngine(TesseractOcrEngine):
@staticmethod
def get_orientation(input_file, options):
with patch('ocrmypdf.exec.tesseract.run', new=raise_size_exception):
with patch('ocrmypdf._exec.tesseract.run', new=raise_size_exception):
return TesseractOcrEngine.get_orientation(input_file, options)
@staticmethod
def generate_hocr(input_file, output_hocr, output_text, options):
with patch('ocrmypdf.exec.tesseract.run', new=raise_size_exception):
with patch('ocrmypdf._exec.tesseract.run', new=raise_size_exception):
TesseractOcrEngine.generate_hocr(
input_file, output_hocr, output_text, options
)
@staticmethod
def generate_pdf(input_file, output_pdf, output_text, options):
with patch('ocrmypdf.exec.tesseract.run', new=raise_size_exception):
with patch('ocrmypdf._exec.tesseract.run', new=raise_size_exception):
TesseractOcrEngine.generate_pdf(
input_file, output_pdf, output_text, options
)
+3 -3
View File
@@ -178,19 +178,19 @@ def cached_run(options, run_args, **run_kwargs):
class CacheOcrEngine(TesseractOcrEngine):
@staticmethod
def get_orientation(input_file, options):
with patch('ocrmypdf.exec.tesseract.run', new=partial(cached_run, options)):
with patch('ocrmypdf._exec.tesseract.run', new=partial(cached_run, options)):
return TesseractOcrEngine.get_orientation(input_file, options)
@staticmethod
def generate_hocr(input_file, output_hocr, output_text, options):
with patch('ocrmypdf.exec.tesseract.run', new=partial(cached_run, options)):
with patch('ocrmypdf._exec.tesseract.run', new=partial(cached_run, options)):
TesseractOcrEngine.generate_hocr(
input_file, output_hocr, output_text, options
)
@staticmethod
def generate_pdf(input_file, output_pdf, output_text, options):
with patch('ocrmypdf.exec.tesseract.run', new=partial(cached_run, options)):
with patch('ocrmypdf._exec.tesseract.run', new=partial(cached_run, options)):
TesseractOcrEngine.generate_pdf(
input_file, output_pdf, output_text, options
)
+3 -3
View File
@@ -41,19 +41,19 @@ def raise_crash(*args, **kwargs):
class CrashOcrEngine(TesseractOcrEngine):
@staticmethod
def get_orientation(input_file, options):
with patch('ocrmypdf.exec.tesseract.run', new=raise_crash):
with patch('ocrmypdf._exec.tesseract.run', new=raise_crash):
return TesseractOcrEngine.get_orientation(input_file, options)
@staticmethod
def generate_hocr(input_file, output_hocr, output_text, options):
with patch('ocrmypdf.exec.tesseract.run', new=raise_crash):
with patch('ocrmypdf._exec.tesseract.run', new=raise_crash):
TesseractOcrEngine.generate_hocr(
input_file, output_hocr, output_text, options
)
@staticmethod
def generate_pdf(input_file, output_pdf, output_text, options):
with patch('ocrmypdf.exec.tesseract.run', new=raise_crash):
with patch('ocrmypdf._exec.tesseract.run', new=raise_crash):
TesseractOcrEngine.generate_pdf(
input_file, output_pdf, output_text, options
)