
    &ew                     
   U d Z ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZ ddlmZ ddlmZmZmZmZmZmZmZmZmZmZ ddlmZ ddlZddlmZmZm Z  ddl!m"Z" dd	l#m$Z$ dd
l%m&Z& ddl'm(Z( ddl)m*Z* ddl+m,Z, ddl-m.Z.m/Z/ ddl0m1Z1m2Z2m3Z3 ddl4m5Z5 ddl6m7Z7m8Z8 ddl9m:Z: ddl;m<Z<  e*e=          Z>e
j?        Z@ edddg          ZA eddg          ZBi de.jC        de.jC        de.jC        de.jC        de.jC        de.jC        de.jC        de.jC        d e.jC        d!e.jC        d"e.jC        d#e.jC        d$e.jC        d%e.jC        d&e.jC        d'e.jC        d(e.jC        i d)e.jC        d*e.jC        d+e.jC        d,e.jC        d-e.jC        d.e.jC        d/e.jC        d0e.jC        d1e.jC        d2e.jC        d3e.jC        d4e.jC        d5e.jC        d6e.jC        d7e.jC        d8e.jD        d9e.jD        i d:e.jD        d;e.jD        d<e.jD        d=e.jD        d>e.jD        d?e.jD        d@e.jD        dAe.jD        dBe.jD        dCe.jD        dDe.jD        dEe.jD        dFe.jD        dGe.jD        dHe.jD        dIe.jD        dJe.jD        dKe.jD        iZEeeFe.f         eGdL<   dMedNeFfdOZHe G dP dQ                      ZI G dR dSe8          ZJ eJ            ZK G dT dUe	jL                  ZM eM            ZNejO        dVedWef         dNed         fdX            ZPejO        dNed         fdY            ZQdZd[d\eFd]edWef         dNdfd^ZRdZd[d\eFdNdfd_ZSd`eIdaeFdbeTdcedWef         ddee1         dNefdeZUd`eIdaeFdedbeTdcedWef         ddee1         dNdfdfZVdedcedWef         ddee1         dNeWfdgZXdaeFdNefdhZYdaeFdedNdfdiZZ	 dd`eIdaeFdjeTdbeTdcedWef         ddee1         dNefdkZ[ e5dl          	 dd`eIdaeFdedjeTdbeTdcedWef         ddee1         fdm            Z\ ednedWef         o          Z]e	 	 	 	 	 	 	 ddVe]djeTdbeTdreTdseTddee1         dtee^         duee_         dNe]fdv            Z`e	 	 	 	 	 	 	 	 ddVddjeTdbeTdreTdseTddee1         dtee^         duee_         dNee]ge]f         fdw            Z`	 	 	 	 	 	 	 	 ddVee]         djeTdbeTdreTdseTddee1         dtee^         duee_         dNeee]ge]f         e]f         fdxZ`dVedWef         ddee1         dNeFfdyZadNeTfdzZbdNeFfd{ZcdNeTfd|Zddd}Ze G d~ def          Zg G d def          Zh G d dei          Zj G d de(          Zk G d de(          ZldVedWef         dNeFfdZmdS )zA library of caching utilities.    N)
namedtuple)	dataclass)
AnyCallableDictIteratorListOptionalTypeVarUnioncastoverload)TTLCache)config	file_utilutil)show_deprecation_warning)spinner)handle_uncaught_app_exception)StreamlitAPIWarning)
get_logger)CACHE_DOCS_URL)	CacheTypeget_decorator_api_name)HashFuncsDict
HashReasonupdate_hash)gather_metrics)	CacheStatCacheStatsProvider)HASHLIB_KWARGS)asizeof_CacheEntryvaluehash_DiskCacheEntrystrfloatintbytesboolzdatetime.datetimezpandas.DataFramezpandas.Seriesznumpy.bool_znumpy.bool8znumpy.ndarrayznumpy.float_znumpy.float16znumpy.float32znumpy.float64znumpy.float96znumpy.float128z
numpy.int_z
numpy.int8znumpy.int16znumpy.int32znumpy.int64z
numpy.intpznumpy.uint8znumpy.uint16znumpy.uint32znumpy.uint64znumpy.uintpzPIL.Image.Imagezplotly.graph_objects.Figurezmatplotlib.figure.Figurezaltair.Chartzpyodbc.Connectionz pymongo.mongo_client.MongoClientzmysql.connector.MySQLConnectionzpsycopg2.connectionzpsycopg2.extensions.connectionz2snowflake.connector.connection.SnowflakeConnectionz#snowflake.snowpark.sessions.Sessionzsqlalchemy.engine.base.Enginezsqlite3.Connectionztorch.nn.Moduleztensorflow.keras.Modelztensorflow.Moduleztensorflow.compat.v1.Sessionztransformers.Pipelinez transformers.PreTrainedTokenizerz$transformers.PreTrainedTokenizerFastz$transformers.PreTrainedTokenizerBaseztransformers.PreTrainedModelztransformers.TFPreTrainedModelz transformers.FlaxPreTrainedModelNEW_CACHE_FUNC_RECOMMENDATIONScached_valuereturnc                     t          |           j        }t                              |          }|d| dt	          |           dt
           dS dt
           dS )zcBuild a deprecation warning string for a cache function that has returned the given
    value.
    Nz`st.cache` is deprecated. Please use one of Streamlit's new caching commands,
`st.cache_data` or `st.cache_resource`. Based on this function's return value
of type `z`, we recommend using `st.z#`.

More information [in our docs](z).z`st.cache` is deprecated. Please use one of Streamlit's new caching commands,
`st.cache_data` or `st.cache_resource`.

More information [in our docs]()type__qualname__r,   getr   r   )r-   typenamecache_type_recs      Hlib/python3.11/site-packages/streamlit/runtime/legacy_caching/caching.py_make_deprecation_warningr6      s     L!!.H377AAN!A A A<RSa<b<bA A /=A A A	
	=*8	= 	= 	=    c                   $    e Zd ZU eed<   eed<   dS )MemCachecachedisplay_nameN)__name__
__module__r1   r   __annotations__r'    r7   r5   r9   r9      s'         OOOr7   r9   c                   |    e Zd ZdZd ZdefdZ	 ddedee         dee         d	ede	f
d
Z
ddZdee         fdZdS )
_MemCachesz%Manages all in-memory st.cache cachesc                 D    t          j                    | _        i | _        d S N)	threadingRLock_lock_function_cachesselfs    r5   __init__z_MemCaches.__init__   s    _&&
57r7   r.   c                 *    t          j        |           S rC   r   repr_rH   s    r5   __repr__z_MemCaches.__repr__       z$r7    keymax_entriesttlr;   c                 \   |t           j        }|t           j        }t          |t          t          f          st          d          t          |t          t          f          st          d          | j        5  | j                            |          }|.|j	        j
        |k    r|j	        j        |k    r|cddd           S t                              d|||           t          ||t                    }t!          ||          }|| j        |<   |cddd           S # 1 swxY w Y   dS )zvReturn the mem cache for the given key.

        If it doesn't exist, create a new one with the given params.
        Nzmax_entries must be an intzttl must be a floatz7Creating new mem_cache (key=%s, max_entries=%s, ttl=%s))maxsizerS   timer)mathinf
isinstancer)   r(   RuntimeErrorrF   rG   r2   r:   rS   rU   _LOGGERdebugr   _TTLCACHE_TIMERr9   )rI   rQ   rR   rS   r;   	mem_cache	ttl_caches          r5   	get_cachez_MemCaches.get_cache   s    (K;(C+U|44 	=;<<<#U|,, 	64555 Z 	 	-11#66I%O'3..O+{:: 	 	 	 	 	 	 	 	 MMI	   !#_UUUI L99I)2D!#&'	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   :>D!AD!!D%(D%Nc                 T    | j         5  i | _        ddd           dS # 1 swxY w Y   dS )zClear all cachesN)rF   rG   rH   s    r5   clearz_MemCaches.clear   sv    Z 	' 	'$&D!	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	' 	's   !!c                     | j         5  | j                                        }d d d            n# 1 swxY w Y   d |                                D             }|S )Nc           
      h    g | ]/}|j         D ]%}t          d |j        t          |                    &0S )st_cache)r:   r   r;   r"   ).0r:   cs      r5   
<listcomp>z(_MemCaches.get_stats.<locals>.<listcomp>   sV     
 
 
[
 
  j%"4gajjAA
 
 
 
r7   )rF   rG   copyvalues)rI   function_cachesstatss      r5   	get_statsz_MemCaches.get_stats   s    Z 	; 	; #388::O	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	; 	;

 
(//11
 
 

 s   .22)rP   r.   N)r<   r=   r1   __doc__rJ   r'   rN   r
   r(   r9   r`   rb   r	   r   rm   r?   r7   r5   rA   rA      s        //8 8 8
 #         + ++ e_+ e_	+
 + 
+ + + +Z' ' ' '
4	?      r7   rA   c                        e Zd Zd ZdefdZdS )ThreadLocalCacheInfoc                 "    g | _         d| _        d S )Nr   )cached_func_stacksuppress_st_function_warningrH   s    r5   rJ   zThreadLocalCacheInfo.__init__   s    ;=,-)))r7   r.   c                 *    t          j        |           S rC   rL   rH   s    r5   rN   zThreadLocalCacheInfo.__repr__   rO   r7   Nr<   r=   r1   rJ   r'   rN   r?   r7   r5   rq   rq      s>        . . . #            r7   rq   func.c              #      K   t           j                            |            	 d V  t           j                                         d S # t           j                                         w xY wrC   )_cache_infors   appendpoprw   s    r5   _calling_cached_functionr}      sa      !((...,%))+++++%))++++s   A  A'c               #      K   t           xj        dz  c_        	 d V  t           xj        dz  c_        t           j        dk    sJ d S # t           xj        dz  c_        t           j        dk    sJ w xY w)N   r   )ry   rt   r?   r7   r5   #suppress_cached_st_function_warningr     s      ,,1,,=00A50071<<<<<< 	00A50071<<<<<<<<s   A )A/dgz!st.delta_generator.DeltaGeneratorst_func_namecached_funcc                     t                      5  t          ||          }|                     |           d d d            d S # 1 swxY w Y   d S rC   )r   CachedStFunctionWarning	exception)r   r   r   es       r5    _show_cached_st_function_warningr     s     
-	.	.  #L+>>
Q                 s   &AA	Ac                     t          t          j                  dk    r5t          j        dk    r't          j        d         }t	          | ||           dS dS dS )a  If appropriate, warn about calling st.foo inside @cache.

    DeltaGenerator's @_with_element and @_widget wrappers use this to warn
    the user when they're calling st.foo() from within a function that is
    wrapped in @st.cache.

    Parameters
    ----------
    dg : DeltaGenerator
        The DeltaGenerator to publish the warning to.

    st_func_name : str
        The name of the Streamlit function that was called.

    r   N)lenry   rs   rt   r   )r   r   r   s      r5   %maybe_show_cached_st_function_warningr     s[    & 	K)**Q..499!3B7(\;GGGGG	 	/.99r7   r^   rQ   allow_output_mutationfunc_or_code
hash_funcsc                    | j         }||v r||         }|sSt          |j        ||          }|j        }||k    r0t                              d|           t          |j        |          t                              dt          |j                             |j        S t                              d|           t          d          )NzCached object was mutated: %szMemory cache HIT: %szMemory cache MISS: %szKey not found in mem cache)	r:   _get_output_hashr$   r%   r[   r\   CachedObjectMutationErrorr0   CacheKeyNotFoundError)	r^   rQ   r   r   r   r:   entrycomputed_output_hashstored_output_hashs	            r5   _read_from_mem_cacher   8  s     OE
e||c
$ 	K#3\:$ $  "'#'999=sCCC/\JJJ,d5;.?.?@@@{ 	-s333#$@AAAr7   c                     |rd }nt          |||          }|j         d|j         | _        t	          ||          | j        |<   d S )N.)r$   r%   )r   r=   r1   r;   r#   r:   )r^   rQ   r$   r   r   r   r%   s          r5   _write_to_mem_cacher   U  s`      A|Z@@ , 7UU,:SUUI&U>>>IOCr7   c                     t          j        di t          }t          | ||t          j        |           |                                S )Nmd5hasherr   hash_reasonhash_source)r   )hashlibnewr!   r   r   CACHING_FUNC_OUTPUTdigest)r$   r   r   r   s       r5   r   r   f  sR     [11.11F2     ==??r7   c                    t          j        dd| z            }	 t          j        |d          5 }t          j        |          }|j        }t                              dt          |                     d d d            n# 1 swxY w Y   n[# t          j
        $ r1}t                              |           t          d|z            d }~wt          $ r t          d          w xY w|S )Nr:   	%s.pickleTbinaryzDisk cache HIT: %szUnable to read from cache: %szKey not found in disk cache)r   get_streamlit_file_pathstreamlit_readpickleloadr$   r[   r\   r0   r   Errorerror
CacheErrorFileNotFoundErrorr   )rQ   pathinputr   r$   r   s         r5   _read_from_disk_cacher   t  s,   ,WkC6GHHD
C%d4888 	=EK&&EKEMM.U<<<	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= 	= : > > >a81<=== C C C#$ABBBCLs;   B AB 4B  BB BB C$,CC$c                    t          j        dd| z            }	 t          j        |d          5 }t          |          }t	          j        ||t          j                   d d d            d S # 1 swxY w Y   d S # t          j        $ rd}t          
                    |           	 t          j        |           n# t          t          t          f$ r Y nw xY wt!          d|z            d }~ww xY w)Nr:   r   Tr   )r$   zUnable to write to cache: %s)r   r   streamlit_writer&   r   dumpHIGHEST_PROTOCOLr   r   r[   r\   osremover   IOErrorOSErrorr   )rQ   r$   r   outputr   r   s         r5   _write_to_disk_cacher     sU   ,WkC6GHHD=&tD999 	@V#%000EKvv'>???	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ : = = =a	IdOOOO!7G4 	 	 	D	 7!;<<<=s^   A; 1A.!A; .A22A; 5A26A; ;C.
C)%B:9C):CC)CC))C.persistc           	         	 t          | ||||          S # t          $ r-}t          t          |                     |j        cY d}~S d}~wt
          $ r3}|r*t          |          }t          | |||||           |cY d}~S |d}~ww xY w)zRead a value from the cache.

    Our goal is to read from memory if possible. If the data was mutated (hash
    changed), we show a warning. If reading from memory fails, we either read
    from disk or rerun the code.
    N)r   r   r   CachedObjectMutationWarningr-   r   r   r   )r^   rQ   r   r   r   r   r   r$   s           r5   _read_from_cacher     s    #s1<
 
 	
 %   %&A!&D&DEEE~     	)#..E3'<lJ   LLLLLLs2    
B"ABB&B:B BB_cache_objectc                 V    t          | |||||           |rt          ||           d S d S rC   )r   r   r^   rQ   r$   r   r   r   r   s          r5   _write_to_cacher     sN     34lJ    )S%((((() )r7   F)boundFTshow_spinnersuppress_st_warningrR   rS   c                     d S rC   r?   rw   r   r   r   r   r   rR   rS   s           r5   r:   r:     	     Cr7   c                     d S rC   r?   r   s           r5   r:   r:     r   r7   c           
      h  
 t                               d|            | dt          dt          ffd}|S | d
t          j                  
f	d            }		 |	j                            j                   n# t          $ r Y nw xY wt          t          |	          S )ap  Function decorator to memoize function executions.

    Parameters
    ----------
    func : callable
        The function to cache. Streamlit hashes the function and dependent code.

    persist : bool
        Whether to persist the cache on disk.

    allow_output_mutation : bool
        Streamlit shows a warning when return values are mutated, as that
        can have unintended consequences. This is done by hashing the return value internally.

        If you know what you're doing and would like to override this warning, set this to True.

    show_spinner : bool
        Enable the spinner. Default is True to show a spinner when there is
        a cache miss.

    suppress_st_warning : bool
        Suppress warnings about calling Streamlit commands from within
        the cached function.

    hash_funcs : dict or None
        Mapping of types or fully qualified names to hash functions. This is used to override
        the behavior of the hasher inside Streamlit's caching mechanism: when the hasher
        encounters an object, it will first check to see if its type matches a key in this
        dict and, if so, will use the provided function to generate a hash for it. See below
        for an example of how this can be used.

    max_entries : int or None
        The maximum number of entries to keep in the cache, or None
        for an unbounded cache. (When a new entry is added to a full cache,
        the oldest cached entry will be removed.) The default is None.

    ttl : float or None
        The maximum number of seconds to keep an entry in the cache, or
        None if cache entries should not expire. The default is None.

    Example
    -------
    >>> import streamlit as st
    >>>
    >>> @st.cache
    ... def fetch_and_clean_data(url):
    ...     # Fetch data from URL here, and then clean it up.
    ...     return data
    ...
    >>> d1 = fetch_and_clean_data(DATA_URL_1)
    >>> # Actually executes the function, since this is the first time it was
    >>> # encountered.
    >>>
    >>> d2 = fetch_and_clean_data(DATA_URL_1)
    >>> # Does not execute the function. Instead, returns its previously computed
    >>> # value. This means that now the data in d1 is the same as in d2.
    >>>
    >>> d3 = fetch_and_clean_data(DATA_URL_2)
    >>> # This is a different URL, so the function executes.

    To set the ``persist`` parameter, use this command as follows:

    >>> @st.cache(persist=True)
    ... def fetch_and_clean_data(url):
    ...     # Fetch data from URL here, and then clean it up.
    ...     return data

    To disable hashing return values, set the ``allow_output_mutation`` parameter to ``True``:

    >>> @st.cache(allow_output_mutation=True)
    ... def fetch_and_clean_data(url):
    ...     # Fetch data from URL here, and then clean it up.
    ...     return data


    To override the default hashing behavior, pass a custom hash function.
    You can do that by mapping a type (e.g. ``MongoClient``) to a hash function (``id``) like this:

    >>> @st.cache(hash_funcs={MongoClient: id})
    ... def connect_to_database(url):
    ...     return MongoClient(url)

    Alternatively, you can map the type's fully-qualified name
    (e.g. ``"pymongo.mongo_client.MongoClient"``) to the hash function instead:

    >>> @st.cache(hash_funcs={"pymongo.mongo_client.MongoClient": id})
    ... def connect_to_database(url):
    ...     return MongoClient(url)

    zEntering st.cache: %sNfr.   c           
      2    t          |           S )Nr   r:   )r   r   r   rR   r   r   r   rS   s    r5   wrapperzcache.<locals>.wrapperQ  s2    &;)$7%'	 	 	 	r7   c            
        	  t          j        d          s"t                              d            	 i S 	j        }t                     dk    rt                    dk    rd|z  }nd|z  } 	
f
d}r5t          |d          5   |            cd	d	d	           S # 1 swxY w Y   d	S  |            S )
zWrapper function that only calls the underlying function on a cache miss.

        Cached objects are stored in the cache/ directory.
        zclient.cachingzPurposefully skipping cacher   zRunning `%s()`.zRunning `%s(...)`.c            
      V  
 t          
          t                              	          } t          j        d          }rt          |t          j        
           rt          |t          j        
           |                                }|d}t          
                    d|           	 t          | |
          }t          
                    d
           n# t          $ r t          
                    d
           t          
          5  r/t                      5   
i }d d d            n# 1 swxY w Y   n 
i }d d d            n# 1 swxY w Y   t          | ||
           Y nw xY wt!          t#          |                     |S )	Nr   r   -zCache key: %s)r^   rQ   r   r   r   r   zCache hit: %szCache miss: %sr   )
_hash_func_mem_cachesr`   r   r   r   r   CACHING_FUNC_ARGS	hexdigestr[   r\   r   r   r}   r   r   r   r6   )r^   value_hasher	value_keyreturn_valuer   args	cache_keyr   kwargsrR   non_optional_funcr   r   rS   s       r5   get_or_create_cached_valuez?cache.<locals>.wrapped_func.<locals>.get_or_create_cached_valuev  s     ''8*EE	 $--icJJI #;u--L ') * < 1     ') * < 1    %..00I $-99ii8IMM/9555/'!#*?!2)      o/@AAAA(   .0ABBB-.?@@ J J* J@BB N N+<+<d+Mf+M+MLN N N N N N N N N N N N N N N (9'8$'I&'I'IJ J J J J J J J J J J J J J J  '!&#*?!2)     * %%>|%L%LMMMsZ   ;0C, ,4F
 E&1	E:E&E

E&E
E&F
&E*	*F
-E*	.F
	F
Tr   N)r   
get_optionr[   r\   r1   r   r   )r   r   namemessager   r   r   r   rR   r   r   r   r   rS   s   ``   r5   wrapped_funczcache.<locals>.wrapped_funcd  st     !122 	6MM7888$$d5f555 -t99>>c&kkQ..'$.GG*T1GR	  R	  R	  R	  R	  R	  R	  R	  R	  R	  R	  R	  R	  R	 h  	0--- 4 411334 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 .-///s   
B**B.1B.)	r[   r\   r   	functoolswraps__dict__updateAttributeErrorr   )rw   r   r   r   r   r   rR   rS   r   r   r   r   s    ```````  @@r5   r:   r:     sB   H MM)4000 |
	q 
	Q 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	 
	  !I_&''i0 i0 i0 i0 i0 i0 i0 i0 i0 i0 i0 i0 ('i0Z$$%6%?@@@@    <   s   /B 
BBc                 4   t          j        d          }t          | j        | j        f|d t
          j        |            t          | ||t
          j        |            |                                }t          	                    d| j        | j        |           |S )Nr   r   zmem_cache key for %s.%s: %s)
r   r   r   r=   r1   r   CACHING_FUNC_BODYr   r[   r\   )rw   r   func_hasherr   s       r5   r   r     s    $ +e$$K 	$+,0    0    %%''IMM%t8I9   r7   c                  :    t                       t                      S )zClear the memoization cache.

    Returns
    -------
    boolean
        True if the disk cache was cleared. False otherwise (e.g. cache file
        doesn't exist on disk).
    )_clear_mem_cache_clear_disk_cacher?   r7   r5   clear_cacher     s     r7   c                  *    t          j        d          S )Nr:   )r   r   r?   r7   r5   get_cache_pathr     s    ,W555r7   c                      t                      } t          j                            |           rt	          j        |            dS dS )NTF)r   r   r   isdirshutilrmtree)
cache_paths    r5   r   r     s?      !!J	w}}Z   j!!!t5r7   c                  8    t                                            d S rC   )r   rb   r?   r7   r5   r   r   )  s    r7   c                       e Zd ZdS )r   Nr<   r=   r1   r?   r7   r5   r   r   -          Dr7   r   c                       e Zd ZdS )r   Nr   r?   r7   r5   r   r   1  r   r7   r   c                        e Zd Zd ZdefdZdS )r   c                 v    || _         t          j        |          r	d| _        d S t	          |          | _        d S )Nza code block)r-   inspectiscodecached_func_name_get_cached_func_name_md)rI   r-   r   s      r5   rJ   z"CachedObjectMutationError.__init__9  sA    (>,'' 	K$2D!!!$<\$J$JD!!!r7   r.   c                 *    t          j        |           S rC   rL   rH   s    r5   rN   z"CachedObjectMutationError.__repr__@  rO   r7   Nrv   r?   r7   r5   r   r   5  sA        K K K #            r7   r   c                   $     e Zd Z fdZd Z xZS )r   c                     |                      ||          }t          t          |                               |           d S rC   )_get_messagesuperr   rJ   )rI   r   r   msg	__class__s       r5   rJ   z CachedStFunctionWarning.__init__E  s=    k::%t,,55c:::::r7   c                 \    d|z  t          |          d}d|z                      d          S )Nz`st.%s()` or `st.write()`)r   	func_namea  
Your script uses %(st_func_name)s to write to your Streamlit app from within
some cached code at %(func_name)s. This code will only be called when we detect
a cache "miss", which can lead to unexpected results.

How to fix this:
* Move the %(st_func_name)s call outside %(func_name)s.
* Or, if you know what you're doing, use `@st.cache(suppress_st_warning=True)`
to suppress the warning.
            
)r  strip)rI   r   r   r   s       r5   r  z$CachedStFunctionWarning._get_messageI  sB    7,F1+>>
 
	 
 %++	r7   r<   r=   r1   rJ   r  __classcell__r
  s   @r5   r   r   D  sG        ; ; ; ; ;      r7   r   c                   $     e Zd Z fdZd Z xZS )r   c                     |                      |          }t          t          |                               |           d S rC   )r  r  r   rJ   )rI   orig_excr	  r
  s      r5   rJ   z$CachedObjectMutationWarning.__init___  s;    )))40099#>>>>>r7   c                 @    dd|j         iz                      d          S )Na7  
Return value of %(func_name)s was mutated between runs.

By default, Streamlit's cache should be treated as immutable, or it may behave
in unexpected ways. You received this warning because Streamlit detected
that an object returned by %(func_name)s was mutated outside of %(func_name)s.

How to fix this:
* If you did not mean to mutate that return value:
  - If possible, inspect your code to find and remove that mutation.
  - Otherwise, you could also clone the returned value so you can freely
    mutate it.
* If you actually meant to mutate the return value and know the consequences of
doing so, annotate the function with `@st.cache(allow_output_mutation=True)`.

For more information and detailed solutions check out [our documentation.]
(https://docs.streamlit.io/library/advanced-features/caching)
            r  r  )r  r  )rI   r  s     r5   r  z(CachedObjectMutationWarning._get_messagec  s+    $ H56%7& %++)	r7   r  r  s   @r5   r   r   ^  sG        ? ? ? ? ?      r7   r   c                 :    t          | d          r
d| j        z  S dS )z1Get markdown representation of the function name.r<   z`%s()`za cached function)hasattrr<   r|   s    r5   r  r  {  s'    tZ   #$-''""r7   rC   )FFTFNNN)NFFTFNNNrn   )nro   
contextlibr   r   r   rW   r   r   r   rD   timecollectionsr   dataclassesr   typingr   r   r   r   r	   r
   r   r   r   r   
cachetoolsr   	streamlitstr   r   r   streamlit.deprecation_utilr   streamlit.elements.spinnerr   streamlit.error_utilr   streamlit.errorsr   streamlit.loggerr   streamlit.runtime.cachingr   $streamlit.runtime.caching.cache_typer   r   (streamlit.runtime.legacy_caching.hashingr   r   r   streamlit.runtime.metrics_utilr   streamlit.runtime.statsr   r    streamlit.utilr!    streamlit.vendor.pympler.asizeofr"   r<   r[   	monotonicr]   r#   r&   DATARESOURCEr,   r'   r>   r6   r9   rA   r   localrq   ry   contextmanagerr}   r   r   r   r+   r   r   r*   r   r   r   r   r   r   r)   r(   r:   r   r   r   r   r   	Exceptionr   r   
ValueErrorr   r   r   r  r?   r7   r5   <module>r3     s   & % %            				        " " " " " " ! ! ! ! ! !                                   - - - - - - - - - - ? ? ? ? ? ? . . . . . . > > > > > > 0 0 0 0 0 0 ' ' ' ' ' ' 4 4 4 4 4 4 R R R R R R R R         
 : 9 9 9 9 9 A A A A A A A A ) ) ) ) ) ) 4 4 4 4 4 4
*X

 . j&(9::*.	::78	9>78 Y^78 
9>	78
 Y^78 IN78 78 	78 Y^78 9>78 9>78 Y^78 IN78 Y^78 Y^78  Y^!78" Y^#78$ in%78 78& ).'78( ).)78* 9>+78, 9>-78. 9>/780 ).1782 9>3784 IN5786 IN7788 IN978: 9>;78< y~=78> "9>?78@ 	A78B INC78F +G78H '	(:I78 78 78J &y'9K78L 9-M78N %i&8O78P 9):LQ78R *9+=S78T $Y%7U78V ),W78X y)Y78Z i0[78\ +]78^ #I$6_78` Y/a78b '	(:c78d +I,>e78f +I,>g78h #I$6i78j %i&8k78 78l '	(:m78 78 S)^ 4 7 7 7tC C    .        
H H H H H# H H HX jll
         9?       #"$$ ,8CH#5 ,(4. , , , , =Xd^ = = = =	+		 #s(#	 
		 	 	 	H+H;>H	H H H H4BB	B  B 38$	B
 'B 	B B B B:??	? ?  	?
 38$? '? 
? ? ? ?"&sCx0>F}>U
   s s     =c =# =$ = = = =0 +/ 	   	
 38$ ' 	   B    +/) ))	) ) 	)
  ) 38$) ') ) ) ! )  GCxS)*** 
 "' %*.!%
 



  
 	

 
 '
 #
 
%
 
 
 
 

 
"' %*.!%
 



  
 	

 
 '
 #
 
%
 qc1f
 
 
 

 "' %*.!%q! q!
1+q!q!  q! 	q!
 q! 'q! #q! 
%q! 8QCFQq! q! q! q!h0Xc3h' 0Xm5L 0QT 0 0 0 0f
T 
 
 
 
6 6 6 6 64       	 	 	 	 	 	 	 		 	 	 	 	I 	 	 	         
          1   4    "5   :#8CH#5 ## # # # # # #r7   