o
    ÂeŸ
  ã                   @  sì   d Z ddlmZ ddlmZ ddlmZ G dd„ deƒZG dd„ deƒZ	G d	d
„ d
e	ƒZ
G dd„ de	ƒZG dd„ de	ƒZG dd„ de	ƒZG dd„ de	ƒZG dd„ de	ƒZG dd„ de	ƒZG dd„ de	ƒZG dd„ de	ƒZG dd„ de	ƒZdS )zOCRmyPDF's exceptions.é    )Úannotations)ÚIntEnum)Údedentc                   @  sD   e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdS )ÚExitCodezOCRmyPDF's exit codes.r   é   é   é   é   é   é   é   é   é	   é
   é   é‚   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__ÚokÚbad_argsÚ
input_fileÚmissing_dependencyZinvalid_output_pdfÚfile_access_errorÚalready_done_ocrÚchild_process_errorÚencrypted_pdfÚinvalid_configZpdfa_conversion_failedÚother_errorZctrl_c© r    r    úCD:\Projects\ConvertPro\env\Lib\site-packages\ocrmypdf/exceptions.pyr      s    r   c                      s*   e Zd ZdZejZdZ‡ fdd„Z‡  Z	S )ÚExitCodeExceptionz>An exception which should return an exit code with sys.exit().Ú c                   s    t ƒ  ¡ }| jr| j |¡S |S )N)ÚsuperÚ__str__ÚmessageÚformat)ÚselfZ	super_msg©Ú	__class__r    r!   r%   %   s   
zExitCodeException.__str__)
r   r   r   r   r   r   Ú	exit_coder&   r%   Ú__classcell__r    r    r)   r!   r"      s
    r"   c                   @  ó   e Zd ZdZejZdS )ÚBadArgsErrorz-Invalid arguments on the command line or API.N)r   r   r   r   r   r   r+   r    r    r    r!   r.   ,   ó    
r.   c                   @  r-   )ÚMissingDependencyErrorz$A third-party dependency is missing.N)r   r   r   r   r   r   r+   r    r    r    r!   r0   2   r/   r0   c                   @  r-   )ÚUnsupportedImageFormatErrorz"The image format is not supported.N©r   r   r   r   r   r   r+   r    r    r    r!   r1   8   r/   r1   c                   @  r-   )ÚDpiErrorz*Missing information about input image DPI.Nr2   r    r    r    r!   r3   >   r/   r3   c                   @  r-   )ÚOutputFileAccessErrorz,Cannot access the intended output file path.N)r   r   r   r   r   r   r+   r    r    r    r!   r4   D   r/   r4   c                   @  r-   )ÚPriorOcrFoundErrorzThis file already has OCR.N)r   r   r   r   r   r   r+   r    r    r    r!   r5   J   r/   r5   c                   @  r-   )ÚInputFileErrorz'Something is wrong with the input file.Nr2   r    r    r    r!   r6   P   r/   r6   c                   @  r-   )ÚSubprocessOutputErrorz*A subprocess returned an unexpected error.N)r   r   r   r   r   r   r+   r    r    r    r!   r7   V   r/   r7   c                   @  s   e Zd ZdZejZedƒZdS )ÚEncryptedPdfErrorz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
        N)	r   r   r   r   r   r   r+   r   r&   r    r    r    r!   r8   \   s    ÿr8   c                   @  s   e Zd ZdZejZdZdS )ÚTesseractConfigErrorz!Tesseract config can't be parsed.z;Error occurred while parsing a Tesseract configuration fileN)r   r   r   r   r   r   r+   r&   r    r    r    r!   r9   n   s    r9   N)r   Ú
__future__r   Úenumr   Útextwrapr   r   Ú	Exceptionr"   r.   r0   r1   r3   r4   r5   r6   r7   r8   r9   r    r    r    r!   Ú<module>   s    