diff --git a/docs/conf.py b/docs/conf.py index 2df277f4..bc77b700 100755 --- a/docs/conf.py +++ b/docs/conf.py @@ -275,7 +275,7 @@ htmlhelp_basename = 'ocrmypdfdoc' # -- Options for LaTeX output --------------------------------------------- -latex_elements = { +latex_elements = { # type: ignore # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', diff --git a/src/ocrmypdf/_validation.py b/src/ocrmypdf/_validation.py index cb55c454..5c595f5e 100644 --- a/src/ocrmypdf/_validation.py +++ b/src/ocrmypdf/_validation.py @@ -13,7 +13,7 @@ import sys import unicodedata from pathlib import Path from shutil import copyfileobj -from typing import List, Set, Tuple, Union +from typing import List, Set, Tuple import pikepdf import PIL @@ -182,10 +182,8 @@ def _pages_from_ranges(ranges: str) -> Set[int]: def check_options_ocr_behavior(options): exclusive_options = sum( - - (1 if opt else 0) - for opt in (options.force_ocr, options.skip_text, options.redo_ocr) - + (1 if opt else 0) + for opt in (options.force_ocr, options.skip_text, options.redo_ocr) ) if exclusive_options >= 2: raise BadArgsError("Choose only one of --force-ocr, --skip-text, --redo-ocr.") diff --git a/src/ocrmypdf/leptonica.py b/src/ocrmypdf/leptonica.py index 9f2554de..a053b43d 100644 --- a/src/ocrmypdf/leptonica.py +++ b/src/ocrmypdf/leptonica.py @@ -66,7 +66,7 @@ if os.name == 'nt': # Loading zlib from other places could cause a version mismatch _zlib_path = os.path.join(os.path.dirname(_libpath), 'zlib1.dll') if not os.path.exists(_zlib_path): - _zlib_path = find_library('zlib') + _zlib_path = find_library('zlib') or '' try: zlib = ffi.dlopen(_zlib_path) except ffi.error as e: diff --git a/src/ocrmypdf/optimize.py b/src/ocrmypdf/optimize.py index fce66464..0df62327 100644 --- a/src/ocrmypdf/optimize.py +++ b/src/ocrmypdf/optimize.py @@ -365,6 +365,7 @@ def convert_to_jbig2( When the JBIG2 symbolic coder is not used, each JBIG2 stands on its own and needs no dictionary. Currently this must be lossless JBIG2. """ + jbig2_globals_dict: Optional[Dictionary] _produce_jbig2_images(jbig2_groups, root, options, executor) diff --git a/src/ocrmypdf/pluginspec.py b/src/ocrmypdf/pluginspec.py index 47de64b6..c7db3e93 100644 --- a/src/ocrmypdf/pluginspec.py +++ b/src/ocrmypdf/pluginspec.py @@ -197,7 +197,7 @@ def rasterize_pdf_page( @hookspec(firstresult=True) -def filter_ocr_image(page: 'PageContext', image: 'Image') -> 'Image': +def filter_ocr_image(page: 'PageContext', image: Image.Image) -> Image.Image: """Called to filter the image before it is sent to OCR. This is the image that OCR sees, not what the user sees when they view the