
    j5j              9         d Z ddlmZ ddlZddlZddlZddlZddlmZm	Z	 ddl
mZ ddlmZ ddlmZ ddlmZmZ dd	lmZ dd
lmZ ddlmZ ddlmZ ddlmZmZ ddlmZ ddl m!Z!m"Z" ddl#m$Z$ ddl%m&Z&m'Z' ddl(m)Z) ee*z  e+z  Z,ee,z  Z- ej\                         Z/	 	 d'	 	 	 	 	 d(dZ0 G d de      Z1dddd	 	 	 	 	 	 	 d)dZ2	 d*	 	 	 	 	 	 	 d+dZ3d,dZ4	 	 	 	 	 	 	 	 d-dZ5eddd	 	 	 	 	 	 	 d.d       Z6edddddddddddddddddddddddddddddddddddddddddddddddddddddddd7	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d/d        Z6	 d*dddddddddddddddddddddddddddddddddddddddddddddddddddddddd7	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d0d!Z6ddddddddddddddddddddddddddddddddddddddddd"(	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d1d#Z7dddddddddddddd$	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 d2d%Z8g d&Z9y)3a"  Python API for OCRmyPDF.

This module provides the main Python API for OCRmyPDF, allowing you to perform
OCR operations programmatically without using the command line interface.

Main Functions:
    ocr(): The primary function for OCR processing. Takes an input PDF or image
        file and produces an OCR'd PDF with searchable text.

    configure_logging(): Set up logging to match the command line interface
        behavior, with support for progress bars and colored output.

Experimental Functions:
    _pdf_to_hocr(): Extract text from PDF pages and save as hOCR files for
        manual editing before final PDF generation.

    _hocr_to_ocr_pdf(): Convert hOCR files back to a searchable PDF after
        manual text corrections.

The API maintains thread safety through internal locking since OCRmyPDF uses
global state for plugins. Only one OCR operation can run per Python process
at a time. For parallel processing, use multiple Python processes.

Example:
    import ocrmypdf

    # Configure logging (optional)
    ocrmypdf.configure_logging(ocrmypdf.Verbosity.default)

    # Perform OCR
    ocrmypdf.ocr('input.pdf', 'output.pdf', language='eng')

For detailed parameter documentation, see the ocr() function docstring and
the equivalent command line parameters in the OCRmyPDF documentation.
    )annotationsN)IterableSequence)IntEnum)IOBase)Path)BinaryIOoverload)warn)PageNumberFilter)
OcrOptions)run_hocr_to_ocr_pdf_pipeline)run_pipelinerun_pipeline_cli)run_hocr_pipeline)OcrmypdfPluginManagerget_plugin_manager)check_options)ArgumentParser
get_parser)ExitCodec                   | r|rt        d      | sg } n&t        | t        t        z        r| g} nt	        |       } |st        |       }|j                  |j                         ddlm	}  |       }|j                         }i }|D ]4  }|s|j                         D ]  \  }}|j                  ||       |||<    6 t        j                  |       ||_        |S )a  Set up plugin infrastructure with proper initialization.

    This function handles:
    1. Creating or validating the plugin manager
    2. Calling plugin initialization hooks
    3. Setting up plugin option registry

    Args:
        plugins: List of plugin paths/names to load
        plugin_manager: Existing plugin manager (if any)

    Returns:
        Properly initialized plugin manager

    Raises:
        ValueError: If both plugins and plugin_manager are provided
    2plugins= and plugin_manager are mutually exclusive)plugin_managerr   )PluginOptionRegistry)
ValueError
isinstancestrr   listr   
initializepluggyocrmypdf._plugin_registryr   register_optionsitemsregister_option_modelr   register_plugin_models_option_registry)	pluginsr   r   registryoption_modelsall_plugin_modelsplugin_options	namespacemodel_classs	            B/var/www/html/qr/venv/lib/python3.12/site-packages/ocrmypdf/api.pysetup_plugin_infrastructurer0   H   s    * >MNN	GS4Z	()w- +G4 ^-B-BC ?#%H #335M)+' ;*8*>*>*@ ;&	;..y+F/:!),;; %%&78 '/N#    c                       e Zd ZdZdZdZdZdZy)	Verbosityz&Verbosity level for configure_logging.r         N)__name__
__module____qualname____doc__quietdefaultdebug	debug_all r1   r/   r3   r3      s    0 EGEIr1   r3   TF)progress_bar_friendlymanage_root_loggerr   c                  |rdnd}t        j                  |      }|j                  t         j                         d}|r|r|j	                         }|s$t        j
                  t        j                        }| dk  r |j                  t         j                         nD| dk\  r |j                  t         j                         n|j                  t         j                         |j                  t                      | dk\  rd}nd	}d}|st        j                  |
      }|j                  |       |j                  |       | dk  rt        j                  d      }	|	j                  t         j                         t        j                  d      }
|
j                  t         j                         t        j                  d      }|j                  t         j                         |rt        j                  d       |S )a  Set up logging.

    Before calling :func:`ocrmypdf.ocr()`, you can use this function to
    configure logging if you want ocrmypdf's output to look like the ocrmypdf
    command line interface. It will register log handlers, log filters, and
    formatters, configure color logging to standard error, and adjust the log
    levels of third party libraries. Details of this are fine-tuned and subject
    to change. The ``verbosity`` argument is equivalent to the argument
    ``--verbose`` and applies those settings. If you have a wrapper
    script for ocrmypdf and you want it to be very similar to ocrmypdf, use this
    function; if you are using ocrmypdf as part of an application that manages
    its own logging, you probably do not want this function.

    If this function is not called, ocrmypdf will not configure logging, and it
    is up to the caller of ``ocrmypdf.ocr()`` to set up logging as it wishes using
    the Python standard library's logging module. If this function is called,
    the caller may of course make further adjustments to logging.

    Regardless of whether this function is called, ocrmypdf will perform all of
    its logging under the ``"ocrmypdf"`` logging namespace. In addition,
    ocrmypdf imports pdfminer, which logs under ``"pdfminer"``. A library user
    may wish to configure both; note that pdfminer is extremely chatty at the
    log level ``logging.INFO``.

    This function does not set up the ``debug.log`` log file that the command
    line interface does at certain verbosity levels. Applications should configure
    their own debug logging.

    Args:
        verbosity: Verbosity level.
        progress_bar_friendly: If True (the default), install a custom log handler
            that is compatible with progress bars and colored output.
        manage_root_logger: Configure the process's root logger.
        plugin_manager: The plugin manager, used for obtaining the custom log handler.

    Returns:
        The toplevel logger for ocrmypdf (or the root logger, if we are managing it).
     ocrmypdfN)streamr   r5   r6   z/%(levelname)7s %(name)s -%(pageno)s %(message)sz%(pageno)s%(message)s)fmtpdfminerPIL	fontToolsT)logging	getLoggersetLevelDEBUGget_logging_consoleStreamHandlersysstderrERRORINFO	addFilterr   	FormattersetFormatter
addHandlercaptureWarnings)	verbosityr@   rA   r   prefixlogconsolerF   	formatterpdfminer_logpil_logfonttools_logs               r/   configure_loggingra      sz   Z &R:F


F
#CLLG/ 446''szz:1}'	a'&&()A~?%I%%#.	#NN7A~((4gmm,##E*&))+6w}}-%Jr1   c                   |
t               }h d|z  }| j                         D cg c]  \  }}|||vr| }}}|j                  |j                                |r't	        ddj                  t        |             d      yc c}}w )a  Check that no individual OCR parameters conflict with OcrOptions.

    When a user passes an OcrOptions object, they should not also pass
    individual OCR parameters (except plugins/plugin_manager which are
    handled separately).

    Args:
        locals_dict: The locals() dict from the calling function.
        kwargs: The **kwargs dict from the calling function.
        excluded: Parameter names to exclude from conflict checking.

    Raises:
        ValueError: If conflicting parameters are found.
    N>   kwargsoptionsr(   r   input_file_or_optionsznWhen passing OcrOptions as the first argument, do not pass additional OCR parameters. Conflicting parameters: z, z). Set these values in OcrOptions instead.)setr$   extendkeysr   joinsorted)locals_dictrc   excludedallowed_with_optionsnamevalue	conflictss          r/    _check_no_conflicting_ocr_paramsrq      s    & 5 	 ',,.D%-A!A 	I  V[[]#Byy	*+, -67
 	
 s   Bc                >   d| v rd| vr| j                  d      }|yt        |t              r|j                  d      }nQg }|D ]H  }t        |t              r%d|v r!|j	                  |j                  d             8|j                  |       J |}|| d<   yd| v r| d= yy)aQ  Map the public API 'language' parameter to OcrOptions 'languages' field.

    The public API uses 'language' (matching CLI --language) but OcrOptions
    uses 'languages' (plural). This also coerces a bare string to a list
    and splits '+'-separated language codes (e.g. 'eng+deu' -> ['eng', 'deu'])
    to match the CLI behavior.
    language	languagesN+)popr   r   splitrg   append)options_kwargslangexpandeditems       r/   _remap_language_to_languagesr}     s     ^#>(I!!*-<dC ::c?D #%H *dC(SD[OODJJsO4OOD)	*
 D&*{#	~	%:& 
&r1   c                X   |j                         }t        |       | |d<   ||d<   d|v rt        |d   t        t        z        r	 |j                         D ci c]  \  }}|	|| }}}i }t        t        j                  j                               }h d}	ddh}
t        |j                               D ]#  }||v s||	v s||
v r|j                  |      ||<   % 	 t        d	i |}|r|j                  j                  |       |S c c}}w # t        $ r}t        d|       |d}~ww xY w)
a  Construct an options object from the input/output files and keyword arguments.

    Args:
        input_file: Input file path or file object.
        output_file: Output file path or file object.
        parser: ArgumentParser object (kept for compatibility,
            may be used for plugin validation).
        **kwargs: Keyword arguments.

    Returns:
        OcrOptions: An options object containing the parsed arguments.

    Raises:
        TypeError: If the type of a keyword argument is not supported.
    
input_fileoutput_filesidecarN>   redo_ocr	force_ocr	skip_textprogress_barr(   zFailed to create OcrOptions: r?   )copyr}   r   r	   r   r$   rf   r   model_fieldsrh   r   rv   extra_attrsupdate	Exception	TypeError)r   r   parserrc   ry   kvr   
ocr_fieldslegacy_mode_flagsknown_extrakeyrd   es                 r/   create_optionsr   :  sZ   & [[]N !0 $.N< $/N=! N"zy!8f#4( 	 (6';';'=Otq!adONO KZ,,1134J> "9-KN'')* 3*'8 8C;<N)--c2C3D.~.&&{3- P.  D7s;<!CDs$   
D#D)D 	D)D$$D)r(   r   c                   y Nr?   )rd   r(   r   s      r/   ocrr   z  s     r1   )7rs   	image_dpioutput_typer   jobsuse_threadstitleauthorsubjectkeywordsrotate_pagesremove_backgrounddeskewcleanclean_finalunpaper_args
oversampleremove_vectorsmoder   r   r   skip_bigoptimizejpg_qualitypng_qualityjbig2_lossyjbig2_page_group_sizejbig2_thresholdpagesmax_image_mpixelstesseract_configtesseract_pagesegmodetesseract_oemtesseract_thresholdingpdf_renderer
rasterizertesseract_timeouttesseract_non_ocr_timeouttesseract_downsample_above!tesseract_downsample_large_imagesrotate_pages_thresholdpdfa_image_compressioncolor_conversion_strategy
user_wordsuser_patternsfast_web_viewcontinue_on_soft_render_errorinvalidate_digital_signaturestagged_pdf_modeno_overwriter(   r   keep_temporary_filesr   c       7             y r   r?   ):re   r   rs   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r(   r   r   r   rc   s:                                                             r/   r   r     s    z r1   c       7        F   t        | t              r| }:t        t               |9       |5r|6rt	        d      |5|:j
                  xs g }5t        |5t        t        z        r|5g}5n|5rt        |5      ng }5t        5  t        |5|6      }6t               };|6j                  |;       t        |:|6       t        |:|6      cddd       S | }<|t        d      |5r|6rt	        d      |5sg }5n&t        |5t        t        z        r|5g}5nt        |5      }5t               j!                         D =>ci c]  \  }=}>|=dvr|=|> }?}=}>|?j#                  |9       t               };t        5  t        |5|6      }6t               };|6j                  |;       d|9v rt%        d	       |rt%        d
       |?j'                  dd       |rt%        d       |?j'                  dd       t)        d|<||;d|?}:t        |:|6       t        |:|6      cddd       S # 1 sw Y   yxY wc c}>}=w # 1 sw Y   yxY w)a  Run OCRmyPDF on one PDF or image.

    This function supports two calling conventions:

    **New style (recommended):**
        >>> from ocrmypdf import ocr
        >>> from ocrmypdf._options import OcrOptions
        >>> options = OcrOptions(
        ...     input_file="input.pdf",
        ...     output_file="output.pdf",
        ...     languages=["eng"],
        ... )
        >>> ocr(options)

    **Old style:**
        >>> ocr("input.pdf", "output.pdf", language=["eng"])

    For most arguments, see documentation for the equivalent command line parameter.

    This API takes a threading lock, because OCRmyPDF uses global state in particular
    for the plugin system. The jobs parameter will be used to create a pool of
    worker threads or processes at different times, subject to change. A Python
    process can only run one OCRmyPDF task at a time.

    To run parallelize instances OCRmyPDF, use separate Python processes to scale
    horizontally. Generally speaking you should set jobs=sqrt(cpu_count) and run
    sqrt(cpu_count) processes as a starting point. If you have files with a high page
    count, run fewer processes and more jobs per process. If you have a lot of short
    files, run more processes and fewer jobs per process.

    A few specific arguments are discussed here:

    Args:
        input_file_or_options: Either an OcrOptions object containing all settings,
            or a path/stream for the input file (old-style API).
        output_file: Output file path or stream. Required when using old-style API
            with input_file as first argument. Must be None when passing OcrOptions.
        use_threads: Use worker threads instead of processes. This reduces
            performance but may make debugging easier since it is easier to set
            breakpoints.
        plugins: List of plugin paths to load. Can be passed alongside OcrOptions.
        plugin_manager: Pre-configured plugin manager. Can be passed alongside
            OcrOptions.

        For input_file (old-style API): If a :class:`pathlib.Path`, ``str`` or
            ``bytes``, this is interpreted as file system path to the input file.
            If the object appears to be a readable stream (with methods such as
            ``.read()`` and ``.seek()``), the object will be read in its entirety
            and saved to a temporary file. If ``input_file`` is ``"-"``, standard
            input will be read.

        For output_file (old-style API): If a :class:`pathlib.Path`, ``str`` or
            ``bytes``, this is interpreted as file system path to the output file.
            If the object appears to be a writable stream (with methods such as
            ``.write()`` and ``.seek()``), the output will be written to this
            stream. If ``output_file`` is ``"-"``, the output will be written to
            ``sys.stdout`` (provided that standard output does not seem to be a
            terminal device). When a stream is used as output, whether via a
            writable object or ``"-"``, some final validation steps are not
            performed (we do not read back the stream after it is written).

    Raises:
        ocrmypdf.MissingDependencyError: If a required dependency program is missing or
            was not found on PATH.
        ocrmypdf.UnsupportedImageFormatError: If the input file type was an image that
            could not be read, or some other file type that is not a PDF.
        ocrmypdf.DpiError: If the input file is an image, but the resolution of the
            image is not credible (allowing it to proceed would cause poor OCR).
        ocrmypdf.OutputFileAccessError: If an attempt to write to the intended output
            file failed.
        ocrmypdf.PriorOcrFoundError: If the input PDF seems to have OCR or digital
            text already, and settings did not tell us to proceed.
        ocrmypdf.InputFileError: Any other problem with the input file.
        ocrmypdf.SubprocessOutputError: Any error related to executing a subprocess.
        ocrmypdf.EncryptedPdfError: If the input PDF is encrypted (password protected).
            OCRmyPDF does not remove passwords.
        ocrmypdf.TesseractConfigError: If Tesseract reported its configuration was not
            valid.
        ValueError: If OcrOptions is passed along with other OCR parameters, or if
            both plugins and plugin_manager are provided.
        TypeError: If output_file is missing when using the old-style API.

    Returns:
        :class:`ocrmypdf.ExitCode`
    r   Nr   r   rd   r   zocr() missing required argument: 'output_file'. Either pass output_file as the second argument, or pass an OcrOptions object as the first argument.>   rc   r   r   r   re   verbosezDocrmypdf.ocr(verbose=) is ignored. Use ocrmypdf.configure_logging().pjbig2_lossy is deprecated and will be ignored. Lossy JBIG2 has been removed due to character substitution risks.r   8jbig2_page_group_size is deprecated and will be ignored.r   )r   r   r   r?   )r   r   rq   localsr   r(   r   r   r   	_api_lockr0   r   add_optionsr   r   r   r$   r   r   rv   r   )@re   r   rs   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r(   r   r   r   rc   rd   r   r   r   r   create_options_kwargss@                                                                   r/   r   r     s\   f '4' 	)6: ~QRR ?oo+GgsTz*iG'.d7mBG  		P8N  \F&&f&5'>2O		P 		P +
>  ~QRRGt,iG7mG
 (!
1 qD!
 !
 	$$V, "	P8N
  \F&&f&5F"8 X &))->$OP%))*A4H$ %' (	G '>2OE"	P "	Pa		P 		PB!
"	P "	Ps    8AH(HBHHH )(rs   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r(   r   c       (           |(r|'rt        d      |(sg }(n&t        |(t        t        z        r|(g}(nt	        |(      }(|*j                         }+| |+d<   d|+d<   t               j                         D ]  \  },}-|,dvs|-|-|+|,<    t        |+       |(r|(|+d<   |+j                         D ./ci c]  \  }.}/|/	|.|/ }+}.}/||+d<   i }0t        t        j                  j                               }1h d	}2d
dh}3t	        |+j                               D ]#  }4|4|1v s|4|2v s|4|3v r|+j                  |4      |0|4<   % t        5  t        |(|'      }'|'j!                  t#                      	 t        di |+}5|0r|5j$                  j'                  |0       t-        |5|'      cddd       S c c}/}.w # t(        $ r}6t+        d|6       |6d}6~6ww xY w# 1 sw Y   yxY w)a  Partially run OCRmyPDF and produces an output folder containing hOCR files.

    Given a PDF file, this function will run OCRmyPDF up to the point where
    the PDF is rasterized to images, OCRed, and the hOCR files are produced,
    all of which are saved to the output folder. This is useful for applications
    that want to provide an interface for users to edit the text before
    rendering the final PDF.

    Use :func:`hocr_to_ocr_pdf` to produce the final PDF.

    For arguments not explicitly documented here, see documentation for the
    equivalent command line parameter.

    This API is **experimental** and subject to change.

    Args:
        input_pdf: Input PDF file path.
        output_folder: Output folder path.
        **kwargs: Keyword arguments.
    r   r   	/dev/nullr   >   rc   r(   	input_pdfoutput_folderr   Nr(   r   >   r   r   r   r   r   r   z/Failed to create OcrOptions for hOCR pipeline: r   r?   )r   r   r   r   r   r   r   r$   r}   rf   r   r   rh   rv   r   r0   r   r   r   r   r   r   r   )7r   r   rs   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r(   r   rc   ry   
param_nameparam_valuer   r   r   r   r   r   r   rd   r   s7                                                          r/   _pdf_to_hocrr     s   D >MNN	GS4Z	()w- [[]N $-N< $/N=! $*8>>#3 5
KXY')4N:&5 !0 $+y! (6';';'=Otq!adONO '4N?# KZ,,1134J>!9-KN'')* 3*'8 8C;<N)--c2C3
 
 Q4N
 	""*,"7	 2>2G##**;7 !P'Q Q# P>  	A!E	Q Qs<   '
F2F5(G(F"G"	F?+F::F??GG)r   r   r   r   r   r   r   r   r   r   r   r   r(   c                  |r|rt        d      |sg }n&t        |t        t        z        r|g}nt	        |      }|j                         }d|d<   ||d<   t               j                         D ]  \  }}|dvs||||<    |r||d<   |j                         D ci c]  \  }}|	|| }}}|rt        d       |j                  d	d       |rt        d
       |j                  dd       | |d<   i }t        t        j                  j                               }h d}ddh}t	        |j                               D ]#  }||v s||v s||v r|j                  |      ||<   % t        5  t        ||      }|j!                  t#                      	 t        di |}|r|j$                  j'                  |       t-        ||      cddd       S c c}}w # t(        $ r}t+        d|       |d}~ww xY w# 1 sw Y   yxY w)ay  Run OCRmyPDF on a work folder and produce an output PDF.

    After running :func:`pdf_to_hocr`, this function will run OCRmyPDF on the work
    folder to produce an output PDF. This function consolidates any changes made
    to the hOCR files in the work folder and produces a final PDF.

    For arguments not explicitly documented here, see documentation for the
    equivalent command line parameter.

    This API is **experimental** and subject to change.

    Args:
        work_folder: Work folder path, as generated by :func:`pdf_to_hocr`.
        output_file: Output PDF file path.
        **kwargs: Keyword arguments.
    r   r   r   r   >   rc   r(   r   work_folderr   Nr(   r   r   r   r   r   >   r   r   r   r   r   r   z6Failed to create OcrOptions for hOCR to PDF pipeline: r   r?   )r   r   r   r   r   r   r   r$   r   rv   rf   r   r   rh   r   r0   r   r   r   r   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r(   rc   ry   r   r   r   r   r   r   r   r   r   rd   r   s                               r/   _hocr_to_ocr_pdfr   M  sK   F >MNN	GS4Z	()w- [[]N $/N< $/N=! $*8>>#3 5
KXY')4N:&5 $+y! (6';';'=Otq!adONO P	
 	=$/GH2D9 %0N=! KZ,,1134J>!9-KN'')* 3*'8 8C;<N)--c2C3
 
 
4N
 	""*,"7	 2>2G##**;7 ,N
'
 
9 PT  	HL	
 
s<   
G'G((G5(G9G5	G2G--G22G55G>)r   r3   r   ra   r   r   r   r   r   r   r0   )NN)r(   Sequence[Path | str] | Noner   OcrmypdfPluginManager | Nonereturnr   )rY   r3   r@   boolrA   r   r   r   r   )rk   dictrc   r   rl   zset[str] | Noner   None)ry   r   r   r   )r   PathOrIOr   r   r   r   r   r   )rd   r   r(   Iterable[Path | str] | Noner   r   r   r   )tre   r   r   r   rs   Iterable[str] | Noner   
int | Noner   
str | Noner   PathOrIO | Noner   r   r   bool | Noner   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   float | Noner   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   os.PathLike | Noner   r   r   r   r   r   r   r   r   r   r   r   r(   r   r   r   r   r   r   r   r   r   )tre   zPathOrIO | OcrOptionsr   r   rs   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r(   r   r   r   r   r   r   r   r   r   )Rr   r   r   r   rs   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r(   r   r   r   )r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r(   r   ):r:   
__future__r   rJ   osrP   	threadingcollections.abcr   r   enumr   ior   pathlibr   typingr	   r
   warningsr   ocrmypdf._loggingr   ocrmypdf._optionsr   #ocrmypdf._pipelines.hocr_to_ocr_pdfr   ocrmypdf._pipelines.ocrr   r   ocrmypdf._pipelines.pdf_to_hocrr   ocrmypdf._plugin_managerr   r   ocrmypdf._validationr   ocrmypdf.clir   r   ocrmypdf.exceptionsr   r   bytesStrPathr   Lockr   r0   r3   ra   rq   r}   r   r   r   r   __all__r?   r1   r/   <module>r     s  "H #  	 
  .    %  . ( L B = N . 3 (
*u
g
 INN	 ,037:(:0: :z  #'$37ZZ  Z 	Z
 1Z@ !%/
/
/
 /
 
	/
d'8=D=D*2=D<J=D=D@ 

 ,037 )	
 1  
 

 &* "## $%)##!"&!! !""#(,$(&*-1(, $)-#!&*.2-159+/)-,0%)(,"&1515"& $+/37(, $u<#<< #	<
 < < < < < < < < < < #<  !<" #<$ %<& '<( )<*  +<, -<. /<0 1<2 3<4 5<6 7<8 9<: ;<< =<> &?<@ "A<B C<D $E<F +G<H &I<J K<L 'M<N O<P Q<R $S<T  ,U<V !+W<X (3Y<Z )[<\ ']<^  *_<` #a<b &c<d  e<f $/g<h $/i<j  k<l m<n )o<p 1q<r &s<t u<x y< 
<B $({P &* "## $%)##!"&!! !""#(,$(&*-1(, $)-#!&*.2-159+/)-,0%)(,"&1515"& $+/37(, $u{P0{P {P #	{P
 {P {P {P {P {P {P {P {P {P {P #{P  !{P" #{P$ %{P& '{P( ){P*  +{P, -{P. /{P0 1{P2 3{P4 5{P6 7{P8 9{P: ;{P< ={P> &?{P@ "A{PB C{PD $E{PF +G{PH &I{PJ K{PL 'M{PN O{PP Q{PR $S{PT  ,U{PV !+W{PX (3Y{PZ )[{P\ ']{P^  *_{P` #a{Pb &c{Pd  e{Pf $/g{Ph $/i{Pj  k{Pl m{Pn )o{Pp 1q{Pr &s{Pt u{Px y{PD &* # $%)##!"&!! !&*-1(, $)-&*.2-159+/!%)(,1515+/(,WHQHQHQ #	HQ
 HQ HQ HQ HQ HQ HQ HQ HQ #HQ HQ HQ  !HQ" #HQ$ %HQ&  'HQ( )HQ* +HQ, -HQ. /HQ0 1HQ2 3HQ4 $5HQ6 +7HQ8 &9HQ: ;HQ< '=HQ> $?HQ@  ,AHQB !+CHQD (3EHQF )GHQH IHQJ #KHQL &MHQN $/OHQP $/QHQT )UHQV &WHQ^ #""#(,$()-,0"&+/!s
s
s
 	s

 s
 s
 s
 s
 s
 &s
 "s
 's
  *s
  s
  )!s
lr1   