diff --git a/src/ocrmypdf/_sync.py b/src/ocrmypdf/_sync.py index b51238a1..c02543b7 100644 --- a/src/ocrmypdf/_sync.py +++ b/src/ocrmypdf/_sync.py @@ -189,7 +189,7 @@ def worker_init(queue): root.addHandler(h) -def worker_thread_init(queue): +def worker_thread_init(_queue): pass @@ -301,7 +301,7 @@ def exec_concurrent(context): class NeverRaise(Exception): """An exception that is never raised""" - pass + pass # pylint: disable=unnecessary-pass def run_pipeline(options, api=False): diff --git a/src/ocrmypdf/exec/tesseract.py b/src/ocrmypdf/exec/tesseract.py index 03bf037d..05e3266e 100644 --- a/src/ocrmypdf/exec/tesseract.py +++ b/src/ocrmypdf/exec/tesseract.py @@ -17,10 +17,8 @@ import os import shutil -import sys from collections import namedtuple from contextlib import suppress -from functools import lru_cache from os import fspath from subprocess import PIPE, STDOUT, CalledProcessError, TimeoutExpired, run diff --git a/src/ocrmypdf/optimize.py b/src/ocrmypdf/optimize.py index bfe027af..bb1269db 100644 --- a/src/ocrmypdf/optimize.py +++ b/src/ocrmypdf/optimize.py @@ -549,11 +549,11 @@ def main(infile, outfile, level, jobs=1): """Emulate ocrmypdf's options""" def __init__( - self, input_file, jobs, optimize, jpeg_quality, png_quality, jb2lossy + self, input_file, jobs, optimize_, jpeg_quality, png_quality, jb2lossy ): self.input_file = input_file self.jobs = jobs - self.optimize = optimize + self.optimize = optimize_ self.jpeg_quality = jpeg_quality self.png_quality = png_quality self.jbig2_page_group_size = 0 @@ -564,7 +564,7 @@ def main(infile, outfile, level, jobs=1): options = OptimizeOptions( input_file=infile, jobs=jobs, - optimize=int(level), + optimize_=int(level), jpeg_quality=0, # Use default png_quality=0, jb2lossy=False, diff --git a/tests/test_main.py b/tests/test_main.py index 399d0662..79625d12 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -217,7 +217,7 @@ def test_skip_ocr(spoof_tesseract_cache, resources, outpdf): assert pdfinfo[0].has_text -def test_redo_ocr(spoof_tesseract_cache, resources, outpdf): +def test_redo_ocr(resources, outpdf): in_ = resources / 'graph_ocred.pdf' before = PdfInfo(in_, detailed_page_analysis=True) out = outpdf diff --git a/tests/test_validation.py b/tests/test_validation.py index e5e3c8f9..5413e375 100644 --- a/tests/test_validation.py +++ b/tests/test_validation.py @@ -16,7 +16,7 @@ # along with OCRmyPDF. If not, see . import os -from unittest.mock import MagicMock, patch, call +from unittest.mock import patch import pytest @@ -135,6 +135,7 @@ def test_no_progress_bar(progress_bar, resources): with patch('ocrmypdf.pdfinfo.info.tqdm', autospec=True) as tqdmpatch: vd.check_options(opts) pdfinfo = PdfInfo(opts.input_file, progbar=opts.progress_bar) + assert pdfinfo is not None assert tqdmpatch.called _args, kwargs = tqdmpatch.call_args assert kwargs['disable'] != progress_bar