
    ȯei)                        d Z ddlmZ ddlZddlZddlZddlmZmZ ddl	m
Z
 erddlmZ ddlmZ ddZdd	Zdd
Z G d deeef         ZddZy)zA bunch of useful utilities.    )annotationsN)TYPE_CHECKINGAny)RootContainer)Callable)DeltaGeneratorc                L     g t        j                         d fd       }|S )z2Decorator to memoize the result of a no-args func.c                 >    sj                                  d   S )Nr   )append)funcresults   P/var/www/html/glpi_dashboard/venv/lib/python3.12/site-packages/streamlit/util.pywrapped_funczmemoize.<locals>.wrapped_func$   s    MM$&!ay    )returnr   )	functoolswraps)r   r   r   s   ` @r   memoizer       s+    F__T 
 r   c                B     j                   j                  }dddg t               i gt        j                         r  fdt        j
                         D        }n#fd j                  j                         D        }dj                  d |D              }| d| d	S )
zA clean repr for a class, excluding both values that are likely defaults,
    and those explicitly default for dataclasses.
    N Fc              3     K   | ]m  }|j                   r_t        |j                        |j                  k7  r<t        |j                        vr$|j                  t        |j                        f o y wN)reprgetattrnamedefault).0fdefaultsselfs     r   	<genexpr>zrepr_.<locals>.<genexpr>6   s^      
vvaff%2aff%X5	 VVWT166*+
s   A3A6c              3  6   K   | ]  \  }}|vs||f  y wr    )r   r   vr   s      r   r!   zrepr_.<locals>.<genexpr>>   s      W&1aQhEV1vWs   	z, c              3  0   K   | ]  \  }}| d |  yw)=Nr#   )r   fieldvalues      r   r!   zrepr_.<locals>.<genexpr>@   s     Q\UEugQui0Qs   ())		__class____name__setdataclassesis_dataclassfields__dict__itemsjoin)r    	classnamefields_valsfield_reprsr   s   `   @r   repr_r7   -   s     ''I  UBr:H%
 ''-
 XDMM,?,?,AW))Q[QQK[+a((r   c                    t        j                  dd      }t        | t              r| j	                  d      n| }|j                  |       |j                         S )ziReturn the md5 hash of the given string.

    This should not be used for security-related purposes.
    md5F)usedforsecurityzutf-8)hashlibnew
isinstancestrencodeupdate	hexdigest)shbs      r   calc_md5rE   D   sD     	E51A'3/QAHHQK;;=r   c                       e Zd ZdZddZddZy)AttributeDictionarya  
    A dictionary subclass that supports attribute-style access.

    This class extends the functionality of a standard dictionary to allow items
    to be accessed via attribute-style dot notation in addition to the traditional
    key-based access. If a dictionary item is accessed and is itself a dictionary,
    it is automatically wrapped in another `AttributeDictionary`, enabling recursive
    attribute-style access.
    c                    	 | j                  |      }t        |t              rt        |      S |S # t        $ r+}t        dt        |       j                   d| d      |d }~ww xY w)N'z' object has no attribute ')__getitem__r=   dictrG   KeyErrorAttributeErrortyper,   )r    keyitemerrs       r   __getattr__zAttributeDictionary.__getattr__]   so    	##C(D0:40F&t,PDP 	 DJ''((CC5J	s   +0 0 	A$&AA$c                    || |<   y r   r#   )r    r   r(   s      r   __setattr__zAttributeDictionary.__setattr__f   s    T
r   N)rO   r>   r   r   )r   r>   r(   r   r   None)r,   
__module____qualname____doc__rR   rT   r#   r   r   rG   rG   R   s    r   rG   c                P    | j                   j                  t        j                  k(  S )z.Check if the DeltaGenerator is in the sidebar.)
_active_dg_root_containerr   SIDEBAR)dgs    r   
in_sidebarr^   j   s    ==((M,A,AAAr   )r   Callable[..., Any]r   r_   )r    r   r   r>   )rB   zbytes | strr   r>   )r]   r   r   bool)rX   
__future__r   r.   r   r;   typingr   r   !streamlit.proto.RootContainer_pb2r   collections.abcr   streamlit.delta_generatorr   r   r7   rE   rK   rG   r^   r#   r   r   <module>rf      sN    # "    % ;(8
).$sCx. 0Br   