Ë
    jË5jJ
  ã                  ó|   — d 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
 ddlmZ  ed¬	«       G d
„ d«      «       Zy)aµ  Probe helper for external executables.

Each ``ocrmypdf._exec.<tool>`` module describes its external program with a
module-level :class:`ToolProbe` and delegates ``version()`` / ``available()``
to it. This separates the "is the tool installed and suitable?" question
(probing) from the "run the tool" question (execution). Work functions stay
as pure module-level functions so they are trivially picklable for use in
subprocess workers.
é    )Úannotations)ÚMapping)Ú	dataclass)ÚVersion)ÚMissingDependencyError)Úget_versionT)Úfrozenc                  ór   — e Zd ZU dZded<   dZded<   dZded<   eZded	<   d
Z	ded<   dZ
ded<   dd„Zdd„Zy
)Ú	ToolProbeaG  Describes how to detect an external executable and its version.

    Attributes:
        program: The program name as it appears on PATH (or a full path).
        version_arg: The argument that elicits a version string.
        version_regex: A regex with a capturing group that extracts the
            version from the program's output.
        version_cls: A :class:`packaging.version.Version` subclass, used for
            tools with non-standard version strings (e.g. Tesseract).
        env: Optional environment overrides applied when probing the version.
        also_catch: Additional exception types that should be treated as
            "not available" by :meth:`available`. :class:`OSError` is useful
            for tools like verapdf whose launcher may fail with non-standard
            errors when the JVM is missing.
    ÚstrÚprogramz	--versionÚversion_argz(\d+(\.\d+)*)Úversion_regexztype[Version]Úversion_clsNzMapping[str, str] | NoneÚenv© ztuple[type[BaseException], ...]Ú
also_catchc                ó’   — t        | j                  | j                  | j                  | j                  ¬«      }| j                  |«      S )zÁReturn the installed version of the program.

        Raises:
            MissingDependencyError: if the program cannot be found or its
                version string cannot be parsed.
        )r   Úregexr   )r   r   r   r   r   r   )ÚselfÚraws     úK/var/www/html/qr/venv/lib/python3.12/site-packages/ocrmypdf/_exec/_probe.pyÚversionzToolProbe.version1   sA   € ô ØL‰LØ×(Ñ(Ø×$Ñ$Ø—‘ô	
ˆð ×Ñ Ó$Ð$ó    c                ód   — 	 | j                  «        y# t        $ r Y y| j                  $ r Y yw xY w)z<Return whether a usable version of the program is installed.FT)r   r   r   )r   s    r   Ú	availablezToolProbe.available@   s8   € ð	ØL‰LŒNð
 øô	 &ò 	ÙØ‰ò 	Ùð	ús   ‚ “	/ž/®/)Úreturnr   )r   Úbool)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú__annotations__r   r   r   r   r   r   r   r   r   r   r   r   r      sL   … ñð  ƒLØ"€KÓ"Ø)€M3Ó)Ø!(€KÓ(Ø$(€CÐ	!Ó(Ø24€JÐ/Ó4ó%ôr   r   N)r"   Ú
__future__r   Úcollections.abcr   Údataclassesr   Úpackaging.versionr   Úocrmypdf.exceptionsr   Úocrmypdf.subprocessr   r   r   r   r   ú<module>r*      s<   ðñõ #å #Ý !å %å 6Ý +ñ $Ô÷/ð /ó ñ/r   