
    q`                     2    d dl Z ddlmZ edfdZedfdZdS )    N   )hashkeyc                       fd}|S )z_Decorator to wrap a function with a memoizing callable that saves
    results in a cache.

    c                 d      fd}n fd}n fd}t          j        |           S )Nc                       | i |S N )argskwargsfuncs     5lib/python3.11/site-packages/cachetools/decorators.pywrapperz*cached.<locals>.decorator.<locals>.wrapper   s    tT,V,,,    c                       | i |}	 |         S # t           $ r Y nw xY w | i |}	 ||<   n# t          $ r Y nw xY w|S r   KeyError
ValueError)r
   r   kvcacher   keys       r   r   z*cached.<locals>.decorator.<locals>.wrapper   s    C((( 8O   DD$)&)) E!HH!   Ds    
  2 
??c                      | i |}	 5  |         cd d d            S # 1 swxY w Y   n# t           $ r Y nw xY w | i |}	 5                      ||          cd d d            S # 1 swxY w Y   d S # t          $ r |cY S w xY wr   r   
setdefaultr   )r
   r   r   r   r   r   r   locks       r   r   z*cached.<locals>.decorator.<locals>.wrapper#   sb   C((( ( ($Qx( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (   DD$)&)) 6 6$//1556 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6!   HHHsZ   . ". &. &. 
;;A9 	A,A9 ,A00A9 3A04A9 9BB	functoolsupdate_wrapper)r   r   r   r   r   s   ` r   	decoratorzcached.<locals>.decorator   s    =- - - - - - \               '666r   r	   r   r   r   r   s   ``` r   cachedr!      s1    &7 &7 &7 &7 &7 &7 &7P r   c                       fd}|S )zoDecorator to wrap a class or instance method with a memoizing
    callable that saves results in a cache.

    c                 T      fd}n fd}t          j        |           S )Nc                      |           }| | g|R i |S  |i |}	 ||         S # t           $ r Y nw xY w | g|R i |}	 |||<   n# t          $ r Y nw xY w|S r   r   )	selfr
   r   cr   r   r   r   methods	         r   r   z0cachedmethod.<locals>.decorator.<locals>.wrapper@   s    E$KK9!6$8888888C(((Q4K   DF41$111&11AaDD!   Ds   , 
99	A 
AAc                 t    |           }| 	| g|R i |S  |i |}	  |           5  ||         cd d d            S # 1 swxY w Y   n# t           $ r Y nw xY w 	| g|R i |}	  |           5  |                    ||          cd d d            S # 1 swxY w Y   d S # t          $ r |cY S w xY wr   r   )
r%   r
   r   r&   r   r   r   r   r   r'   s
         r   r   z0cachedmethod.<locals>.decorator.<locals>.wrapperR   s   E$KK9!6$8888888C(((d $ $ t$ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $   DF41$111&11d 2 2 ||Aq112 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2!   HHHsi   A AA AA AA 
AA-B( 8BB( BB( "B#B( (B76B7r   )r'   r   r   r   r   s   ` r   r   zcachedmethod.<locals>.decorator=   sn    <       $       $ '888r   r	   r    s   ``` r   cachedmethodr)   7   s1    '9 '9 '9 '9 '9 '9 '9R r   )r   keysr   r!   r)   r	   r   r   <module>r+      sd              D . . . .b $$ / / / / / /r   