
    gK                        U d dl mZ d dlmZ d dlZd dlmc mZ d dlmZ d dl	m
Z
 d dlmZ  ee      Zded<   dd	Zdd
ZddZy)    )annotations)FinalN)config)get_dg_singleton_instance)
get_loggerr   _LOGGERc                   ddl mm}  G fdd|j                        }ddl m} ||_        ddlm}  |ddd	d
d      }|j                  |j                  j                  t        |       | | j                  d	d
dd
dt        g	             y )Nr   )boxpanelc                  D     e Zd ZW j                  d      f fd	Z xZS )0_print_rich_exception.<locals>.ConfigurablePaneluP   ────
    
────
    
────
────
    
────
c                (    t        |   ||fi | y )N)super__init__)self
renderabler
   kwargs	__class__s       I/var/www/openai/venv/lib/python3.12/site-packages/streamlit/error_util.pyr   z9_print_rich_exception.<locals>.ConfigurablePanel.__init__!   s     GZ77    )__name__
__module____qualname__Boxr   __classcell__)r   r
   s   @r   ConfigurablePanelr       s     rs	8 	8r   r   )	traceback)Console256TX   F   )color_systemforce_terminalwidthno_colortab_sized      )r$   show_locals
max_frames	word_wrapextra_linessuppress)richr
   r   Panelr   rich.consoler   print	Tracebackfrom_exceptiontype__traceback__	streamlit)er   r   rich_tracebackr   consoler
   s         @r   _print_rich_exceptionr:      s    8EKK 8 1,N %G MM  //GOO[ 	0 
	
r   c                \    t               j                  }t        j                  || d       y)z#Show the exception on the frontend.T)is_uncaught_app_exceptionN)r   main_dg	exception
_exception)exmain_delta_generators     r   _show_exceptionrB   H   s$    46>>-rTRr   c                    d}t        j                  d      r	 t        |        d}|st        j                  d|        t        |        y# t        $ r d}Y 2w xY w)zHandle an exception that originated from a user app.

    By default, we show exceptions directly in the browser. However,
    if the user has disabled client error details, we display a generic
    warning in the frontend instead.
    Fzlogger.enableRichTzUncaught app execution)exc_infoN)r   
get_optionr:   	Exceptionr   errorrB   )r@   error_loggeds     r   handle_uncaught_app_exceptionrI   N   sb     L,-
	! ""%L .<B  	! !L		!s   A AA)r7   BaseExceptionreturnNone)r@   rJ   rK   rL   )
__future__r   typingr   r6   streamlit.elements.exceptionelementsr>   r   $streamlit.delta_generator_singletonsr   streamlit.loggerr   r   r   __annotations__r:   rB   rI    r   r   <module>rU      s?    #   0 0  J 'H% %)XSr   