
    TAi                    v   S r SSKJr  SSKJr  SSKJr   " S S\5      r " S S\5      r	 " S	 S
\	5      r
 " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\	5      r " S S\5      r " S S \5      r " S! S"\
5      rg#)$zOCRmyPDF's exceptions.    )annotations)IntEnum)dedentc                  L    \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrSrSrSrSrg)ExitCode   zOCRmyPDF's exit codes.r                           	   
          N)__name__
__module____qualname____firstlineno____doc__okbad_args
input_filemissing_dependencyinvalid_output_pdffile_access_erroralready_done_ocrchild_process_errorencrypted_pdfinvalid_configpdfa_conversion_failedother_errorctrl_c__static_attributes__r       O/var/www/html/land-ocr/venv/lib/python3.13/site-packages/ocrmypdf/exceptions.pyr   r      sN      
BHJMNKFr)   r   c                  H   ^  \ rS rSrSr\R                  rSrU 4S jr	Sr
U =r$ )ExitCodeException   z>An exception which should return an exit code with sys.exit(). c                |   > [         TU ]  5       nU R                  (       a  U R                  R                  U5      $ U$ )z0Return a string representation of the exception.)super__str__messageformat)self	super_msg	__class__s     r*   r1   ExitCodeException.__str__%   s1    GO%	<<<<&&y11r)   r   )r   r   r   r   r   r   r&   	exit_coder2   r1   r(   __classcell__)r6   s   @r*   r,   r,      s     H$$IG r)   r,   c                  0    \ rS rSrSr\R                  rSrg)BadArgsError-   z-Invalid arguments on the command line or API.r   N)	r   r   r   r   r   r   r   r8   r(   r   r)   r*   r;   r;   -   s    7!!Ir)   r;   c                  0    \ rS rSrSr\R                  rSrg)MissingDependencyError3   z$A third-party dependency is missing.r   N)	r   r   r   r   r   r   r   r8   r(   r   r)   r*   r>   r>   3   s    .++Ir)   r>   c                  0    \ rS rSrSr\R                  rSrg)UnsupportedImageFormatError9   z"The image format is not supported.r   N	r   r   r   r   r   r   r   r8   r(   r   r)   r*   rA   rA   9   s    ,##Ir)   rA   c                  0    \ rS rSrSr\R                  rSrg)DpiError?   z*Missing information about input image DPI.r   NrC   r   r)   r*   rE   rE   ?   s    4##Ir)   rE   c                  0    \ rS rSrSr\R                  rSrg)OutputFileAccessErrorE   z,Cannot access the intended output file path.r   N)	r   r   r   r   r   r   r    r8   r(   r   r)   r*   rH   rH   E   s    6**Ir)   rH   c                  0    \ rS rSrSr\R                  rSrg)PriorOcrFoundErrorK   zThis file already has OCR.r   N)	r   r   r   r   r   r   r!   r8   r(   r   r)   r*   rK   rK   K   s    $))Ir)   rK   c                  0    \ rS rSrSr\R                  rSrg)InputFileErrorQ   z'Something is wrong with the input file.r   NrC   r   r)   r*   rN   rN   Q   s    1##Ir)   rN   c                  0    \ rS rSrSr\R                  rSrg)SubprocessOutputErrorW   z*A subprocess returned an unexpected error.r   N)	r   r   r   r   r   r   r"   r8   r(   r   r)   r*   rQ   rQ   W   s    4,,Ir)   rQ   c                  @    \ rS rSrSr\R                  r\" S5      r	Sr
g)EncryptedPdfError]   zInput PDF is encrypted.a/          Input PDF is encrypted. The encryption must be removed to
        perform OCR.

        For information about this PDF's security use
            qpdf --show-encryption infilename

        You can remove the encryption using
            qpdf --decrypt [--password=[password]] infilename
        r   N)r   r   r   r   r   r   r#   r8   r   r2   r(   r   r)   r*   rT   rT   ]   s    !&&I		Gr)   rT   c                  4    \ rS rSrSr\R                  rSrSr	g)TesseractConfigErroro   z!Tesseract config can't be parsed.z;Error occurred while parsing a Tesseract configuration filer   N)
r   r   r   r   r   r   r$   r8   r2   r(   r   r)   r*   rW   rW   o   s    +''IKGr)   rW   c                  (    \ rS rSrSr\" S5      rSrg)DigitalSignatureErrorv   zPDF has a digital signature.zu        Input PDF has a digital signature. OCR would alter the document,
        invalidating the signature.
        r   Nr   r   r   r   r   r   r2   r(   r   r)   r*   rZ   rZ   v   s    &	Gr)   rZ   c                  (    \ rS rSrSr\" S5      rSrg)TaggedPDFError   zPDF is tagged.z        This PDF is marked as a Tagged PDF. This often indicates
        that the PDF was generated from an office document and does
        not need OCR. Use --force-ocr, --skip-text or --redo-ocr to
        override this error.
        r   Nr\   r   r)   r*   r^   r^      s    	Gr)   r^   c                  (    \ rS rSrSr\" S5      rSrg)ColorConversionNeededError   zPDF needs color conversion.z        The input PDF has an unusual color space. Use
        --color-conversion-strategy to convert to a common color space
        such as RGB, or use --output-type pdf to skip PDF/A conversion
        and retain the original color space.
        r   Nr\   r   r)   r*   ra   ra      s    %	Gr)   ra   N)r   
__future__r   enumr   textwrapr   r   	Exceptionr,   r;   r>   rA   rE   rH   rK   rN   rQ   rT   rW   rZ   r^   ra   r   r)   r*   <module>rg      s     "  w &	 "$ ",. ,$"3 $$  $+- +** *$& $-- -) $L, LN 
^ 

 
r)   