
    ;3h                    x   d dl mZ d dlmZ d dlmZ  G d de      Z G d de      Z G d d	e	      Z
 G d
 de	      Z G d de      Z G d de	      Z G d de      Z G d de      Z G d de	      ZeZ ed       G d de             Z G d de      Z G d de      Z G d de	      Z G d  d!e      Zy")#    )annotations)document)AppErrorc                      e Zd ZdZy)DuplicateBlockErrorzBRaised when a Blocks contains more than one Block with the same idN__name__
__module____qualname____doc__     Q/var/www/html/audio-gradio/venv/lib/python3.12/site-packages/gradio/exceptions.pyr   r      s    Lr   r   c                      e Zd ZdZy)InvalidComponentErrorz(Raised when invalid components are used.Nr   r   r   r   r   r          2r   r   c                      e Zd ZdZy)ModelNotFoundErrorzVRaised when the provided model doesn't exists or is not found by the provided api url.Nr   r   r   r   r   r      s    `r   r   c                      e Zd ZdZy)RenderErrorzjRaised when a component has not been rendered in the current Blocks but is expected to have been rendered.Nr   r   r   r   r   r      s    tr   r   c                      e Zd Zy)InvalidApiNameErrorNr	   r
   r   r   r   r   r   r          r   r   c                      e Zd Zy)ServerFailedToStartErrorNr   r   r   r   r   r   #   r   r   r   c                      e Zd ZdZy)InvalidBlockErrorzcRaised when an event in a Blocks contains a reference to a Block that is not in the original BlocksNr   r   r   r   r   r   '   s    mr   r   c                      e Zd ZdZy)ReloadErrorz?Raised when something goes wrong when reloading the gradio app.Nr   r   r   r   r    r    -   s    Ir   r    c                      e Zd ZdZy)GradioVersionIncompatibleErrorz(Raised when loading a 3.x space with 4.0Nr   r   r   r   r"   r"   3   r   r   r"   modals)documentation_groupc                  H     e Zd ZdZ	 	 	 	 	 d	 	 	 	 	 	 	 	 	 d fdZd Z xZS )Errora  
    This class allows you to pass custom error messages to the user. You can do so by raising a gr.Error("custom message") anywhere in the code, and when that line is executed the custom message will appear in a modal on the demo.
    Example:
        import gradio as gr
        def divide(numerator, denominator):
            if denominator == 0:
                raise gr.Error("Cannot divide by zero!")
        gr.Interface(divide, ["number", "number"], "number").launch()
    Demos: calculator, blocks_chained_events
    c                .    t         |   |||||       y)a?  
        Parameters:
            message: The error message to be displayed to the user. Can be HTML, which will be rendered in the modal.
            duration: The duration in seconds to display the error message. If None or 0, the error message will be displayed until the user closes it.
            visible: Whether the error message should be displayed in the UI.
            title: The title to be displayed to the user at the top of the error modal.
            print_exception: Whether to print traceback of the error to the console when the error is raised.
        )messagedurationvisibletitleprint_exceptionNsuper__init__)selfr(   r)   r*   r+   r,   	__class__s         r   r/   zError.__init__I   s&      	+ 	 	
r   c                ,    t        | j                        S N)reprr(   )r0   s    r   __str__zError.__str__a   s    DLL!!r   )zError raised.
   Tr&   T)
r(   strr)   zfloat | Noner*   boolr+   r7   r,   r8   )r	   r
   r   r   r/   r5   __classcell__r1   s   @r   r&   r&   <   sS    	 '!# $

 
 	

 
 
0"r   r&   c                      e Zd Zy)ComponentDefinitionErrorNr   r   r   r   r<   r<   e   r   r   r<   c                      e Zd Zy)InvalidPathErrorNr   r   r   r   r>   r>   i   r   r   r>   c                      e Zd Zy)ChecksumMismatchErrorNr   r   r   r   r@   r@   m   r   r   r@   c                  &     e Zd ZdZdd fdZ xZS )TooManyRequestsErrorz;Raised when the Hugging Face API returns a 429 status code.c                $    t         |   |       y r3   r-   )r0   r(   r1   s     r   r/   zTooManyRequestsError.__init__t   s    !r   )z*Too many requests. Please try again later.)r(   r7   )r	   r
   r   r   r/   r9   r:   s   @r   rB   rB   q   s    E" "r   rB   N)
__future__r   gradio_client.documentationr   gradio_client.exceptionsr   
ValueErrorr   r   	Exceptionr   r   r   r   r   r    r"   InvalidApiNamer&   NotImplementedErrorr<   r>   r@   rB   r   r   r   <module>rK      s    " 0 -	* 		J 		 		) 		* 		y 		
 		* 		Y 	 % 
h'%"H %" (%"P	2 		z 		I 	"5 "r   