
    %ek                        d dl mZ d dlZd dlmZmZmZmZmZ d dl	Z	d dl	m
Z
 d dlmZ  ee          Z ededef                   Z ed	e          Zd!dZd"dZ	 	 d#d$dZ	 	 d%d&dZ	 d'd(dZd)d ZdS )*    )annotationsN)AnyCallableListTypeVarcast)config)
get_loggerTFunc.)boundTObjreturnboolc                 D    t          t          j        d                    S )z<True if we should print deprecation warnings to the browser.zclient.showErrorDetails)r   r	   
get_option     :lib/python3.11/site-packages/streamlit/deprecation_util.py+_should_show_deprecation_warning_in_browserr      s    !";<<===r   messagestrNonec                ~    t                      rt          j        |            t                              |            dS )z#Show a deprecation warning message.N)r   	streamlitwarning_LOGGER)r   s    r   show_deprecation_warningr   "   s;    244 #'""" OOGr   Told_namenew_nameremoval_dateextra_message
str | Noneinclude_st_prefixc           	     L    |r
d|  } d| }d|  d| d|  d| d	|rd| ndz   S )	Nzst.zPlease replace `z` with `z`.

`z` will be removed after .z

 r   )r   r   r    r!   r#   s        r   make_deprecated_name_warningr'   +   s      $######	>8 	> 	>X 	> 	>	> 	>.:	> 	> 	>%2:!-!!!	<r   funcname_overridec                     t          j                    fd            }|_         j        |_        t	          t
          |          S )a  Wrap an `st` function whose name has changed.

    Wrapped functions will run as normal, but will also show an st.warning
    saying that the old name will be removed after removal_date.

    (We generally set `removal_date` to 3 months from the deprecation date.)

    Parameters
    ----------
    func
        The `st.` function whose name has changed.

    old_name
        The function's deprecated name within __init__.py.

    removal_date
        A date like "2020-01-01", indicating the last day we'll guarantee
        support for the deprecated name.

    extra_message
        An optional extra message to show in the deprecation warning.

    name_override
        An optional name to use in place of func.__name__.
    c                 d     | i |}t          t          pj                             |S N)r   r'   __name__)argskwargsresultr!   r(   r)   r   r    s      r   wrapped_funcz)deprecate_func_name.<locals>.wrapped_func^   sM    t&v&& (-84=, 	
 	
 	

 r   )	functoolswrapsr-   __doc__r   r   )r(   r   r    r!   r)   r1   s   ````` r   deprecate_func_namer5   =   sp    B _T         %L<L|$$$r   objc                6    t          | fd          S )a  Wrap an `st` object whose name has changed.

    Wrapped objects will behave as normal, but will also show an st.warning
    saying that the old name will be removed after `removal_date`.

    (We generally set `removal_date` to 3 months from the deprecation date.)

    Parameters
    ----------
    obj
        The `st.` object whose name has changed.

    old_name
        The object's deprecated name within __init__.py.

    new_name
        The object's new name within __init__.py.

    removal_date
        A date like "2020-01-01", indicating the last day we'll guarantee
        support for the deprecated name.

    include_st_prefix
        If False, does not prefix each of the object names in the deprecation
        essage with `st.*`. Defaults to True.
    c                 D    t          t                               S )N)r#   )r   r'   )r#   r   r   r    s   r   <lambda>z$deprecate_obj_name.<locals>.<lambda>   s.    (((LDU  
 
 r   )_create_deprecated_obj_wrapper)r6   r   r   r    r#   s    ````r   deprecate_obj_namer;   n   sA    D *	
 	
 	
 	
 	
 	
 	
  r   show_warningCallable[[], Any]c                z     ddfd G  fdd          t          t                                 S )zCreate a wrapper for an object that has been deprecated. The first
    time one of the object's properties or functions is accessed, the
    given `show_warning` callback will be called.
    Fr   r   c                 (     sd               d S d S NTr   )has_shown_warningr<   s   r   maybe_show_warningz:_create_deprecated_obj_wrapper.<locals>.maybe_show_warning   s,     ! 	 $LNNNNN	 	r   c                  \    e Zd Z fdZfdZedd            Zefd            ZdS )	/_create_deprecated_obj_wrapper.<locals>.Wrapperc           
                              j                  D ]8}t          | j        |t          |                     |                               9d S r,   )_get_magic_functions	__class__setattrproperty_make_magic_function_proxy)selfnameWrapperr6   s     r   __init__z8_create_deprecated_obj_wrapper.<locals>.Wrapper.__init__   sd    44S]CC  NT<<TBBCC    r   c                j    || j         v rt          | |          S               t          |          S r,   )__dict__getattr)rK   attrrB   r6   s     r   __getattr__z;_create_deprecated_obj_wrapper.<locals>.Wrapper.__getattr__   sA    
 t}$$tT***   3%%%r   r   	List[str]c                >    dfdt          |           D             S )N)rG   rP   __getattribute__rS   c                F    g | ]}|v|                     d           |S )__)
startswith).0rL   ignores     r   
<listcomp>zX_create_deprecated_obj_wrapper.<locals>.Wrapper._get_magic_functions.<locals>.<listcomp>   s?       v%%$//$*?*?% %%%r   )dir)clsr[   s    @r   rF   zD_create_deprecated_obj_wrapper.<locals>.Wrapper._get_magic_functions   s<     RF   HH   r   c                      fd}|S )Nc                8                  t                    S r,   )rQ   )rK   r.   rB   rL   r6   s     r   proxyzY_create_deprecated_obj_wrapper.<locals>.Wrapper._make_magic_function_proxy.<locals>.proxy   s"    ""$$$sD)))r   r   )rL   ra   rB   r6   s   ` r   rJ   zJ_create_deprecated_obj_wrapper.<locals>.Wrapper._make_magic_function_proxy   s.    * * * * * * * Lr   N)r   rT   )r-   
__module____qualname__rN   rS   staticmethodrF   rJ   )rM   rB   r6   s   r   rM   rD      s        	 	 	 	 	 			& 		& 		& 		& 		& 		& 
	 	 	 
	 
	 	 	 	 	 
	 	 	r   rM   )r   r   )r   r   )r6   r<   rM   rA   rB   s   ``@@@r   r:   r:      s    
       & & & & & & & & & & & &P ggii   r   )r   r   )r   r   r   r   r@   )r   r   r   r   r    r   r!   r"   r#   r   r   r   )NN)r(   r   r   r   r    r   r!   r"   r)   r"   r   r   )T)r6   r   r   r   r   r   r    r   r#   r   r   r   )r6   r   r<   r=   r   r   )
__future__r   r2   typingr   r   r   r   r   r   r	   streamlit.loggerr
   r-   r   r   objectr   r   r   r'   r5   r;   r:   r   r   r   <module>ri      sg   # " " " " "     5 5 5 5 5 5 5 5 5 5 5 5 5 5           ' ' ' ' ' '
*X

xS1222wvV$$$> > > >
    !%"    , !% $.% .% .% .% .%l #) ) ) ) )X6! 6! 6! 6! 6! 6!r   