
    Zi                         S r SSKJr  Sr " S S\5      r " S S\5      r " S S	\5      r " S
 S\5      r " S S\5      r	g)zCustom exceptions for textract.    )Path   c                   *    \ rS rSrSrS\S\4S jrSrg)CommandLineError
   zThe traceback of all CommandLineError's is suppressed when the
errors occur on the command line to provide a useful command line
interface.
msgreturnc                     U[        U 5      -  $ Nvars)selfr   s     m/var/www/eduai.edurigo.com/question_generate/ques_gen_env/lib/python3.13/site-packages/textract/exceptions.pyrenderCommandLineError.render   s    T$Z     N)__name__
__module____qualname____firstlineno____doc__strr   __static_attributes__r   r   r   r   r   
   s    
 #  #  r   r   c                   0    \ rS rSrSrS\SS4S jrS rSrg)	ExtensionNotSupported   z0This error is raised with unsupported extensionsextr	   Nc                     Xl         SSKJn  U" 5        Vs/ s H  o3R                  S5      (       d  M  UPM     nnSR	                  U5      U l        gs  snf )z&Initialize with unsupported extension.   )_get_available_extensions.z, N)r   parsersr!   
startswithjoinavailable_extensions_str)r   r   r!   eavailable_extensionss        r   __init__ExtensionNotSupported.__init__   sN    6 12 
2!ll36GA2 	  
 )-		2F(G% 
s
   AAc                 $    U R                  S5      $ )NzThe filename extension %(ext)s is not yet supported by
textract. Please suggest this filename extension here:

    https://github.com/deanmalmgren/textract/issues

Available extensions include: %(available_extensions_str)s
r   r   s    r   __str__ExtensionNotSupported.__str__"   s    {{O
 	
r   )r&   r   	r   r   r   r   r   r   r)   r.   r   r   r   r   r   r      s     :	HC 	HD 	H
r   r   c                   0    \ rS rSrSrS\SS4S jrS rSrg)	MissingFileError-   zMThis error is raised when the file can not be located at the
specified path.
filenamer	   Nc                 j    Xl         [        U5      nUR                  U l        UR                  U l        g)z"Initialize with missing file path.N)r4   r   stemrootsuffixr   )r   r4   ps      r   r)   MissingFileError.__init__2   s&     NFF	88r   c                 $    U R                  S5      $ )NzdThe file "%(filename)s" can not be found.
Is this the right path/to/file/you/want/to/extract%(ext)s?r,   r-   s    r   r.   MissingFileError.__str__9   s    {{M
 	
r   )r   r4   r7   r0   r   r   r   r2   r2   -   s      
r   r2   c                   0    \ rS rSrSrS\SS4S jrS rSrg)	UnknownMethodB   zQThis error is raised when the specified --method on the command
line is unknown.
methodr	   Nc                     Xl         g)z$Initialize with unknown method name.Nr@   )r   r@   s     r   r)   UnknownMethod.__init__G   s    r   c                 $    U R                  S5      $ )Nz;The method "%(method)s" can not be found for this filetype.r,   r-   s    r   r.   UnknownMethod.__str__K   s    {{J
 	
r   rB   r0   r   r   r   r>   r>   B   s    s t 
r   r>   c            
       n    \ rS rSrSrS\S\S\S\SS4
S	 jrS\	4S
 jr
S\4S jrS\4S jrS\4S jrSrg)
ShellErrorQ   zaThis error is raised when a shell.run returns a non-zero exit code
(meaning the command failed).
command	exit_codestdoutstderrr	   Nc                 x    Xl         X l        X0l        X@l        U R                   R	                  5       S   U l        g)z*Initialize with command execution details.r   N)rI   rJ   rK   rL   split
executable)r   rI   rJ   rK   rL   s        r   r)   ShellError.__init__V   s1     ",,,,.q1r   c                 (    U R                   [        :H  $ )z@Check if the command failed because executable is not installed.)rJ   _NOT_INSTALLED_EXIT_CODEr-   s    r   is_not_installedShellError.is_not_installed`   s    ~~!999r   c                 8    SR                   " S0 [        U 5      D6$ )z6Format error message when executable is not installed.zThe command `{command}` failed because the executable
`{executable}` is not installed on your system. Please make
sure the appropriate dependencies are installed before using
textract:

    http://textract.readthedocs.org/en/latest/installation.html
r   )formatr   r-   s    r   not_installed_message ShellError.not_installed_messaged   s,    P
 &  : 	r   c                     S[        U 5      -  $ )z3Format error message when command execution failed.zThe command `%(command)s` failed with exit code %(exit_code)d
------------- stdout -------------
%(stdout)s------------- stderr -------------
%(stderr)sr   r-   s    r   failed_messageShellError.failed_messagen   s    
 J 	r   c                 l    U R                  5       (       a  U R                  5       $ U R                  5       $ r   )rS   rW   rZ   r-   s    r   r.   ShellError.__str__x   s/      ""--//""$$r   )rI   rO   rJ   rL   rK   )r   r   r   r   r   r   intbytesr)   boolrS   rW   rZ   r.   r   r   r   r   rG   rG   Q   sd    22'*2492CH2	2:$ :s  % %r   rG   N)
r   pathlibr   rR   	Exceptionr   r   r2   r>   rG   r   r   r   <module>rc      sS    %    y  
, 
2
' 
*
$ 
*%! *%r   