
    Kiv7                         d Z dZddlZddlZddlZd Zd Zd Z G d d      Z G d	 d
      Z	 G d de	      Z
d Zd Zd Zd Zd Zd ZddZy)zMethod decorator helpers.     Nc                 <    t        j                  dt        |        y )Nz9decorating class methods with @cachedmethod is deprecated
stacklevelwarningswarnDeprecationWarningr   s    d/home/jay/workspace/scripts/.codegraph-venv/lib/python3.12/site-packages/cachetools/_cachedmethod.py_warn_classmethodr   
   s    MMC    c                 <    t        j                  | t        |       y )Nr   r   )msgr   s     r   _warn_instance_dictr      s    MMr   c                      y Nr   )_s    r   _noner      s    r   c                   d    e Zd ZdZd
dZd Zd Zed        Zed        Z	ed        Z
ed	        Zy)_WrapperBasezDWrapper base class providing default implementations for properties.Nc                    t        |t              rt        d       t        j                  | |       || _        || _        t        j                  ||      | _        ||nt        | _
        ||| _        y t        | _        y )N   r   )
isinstancetyper   	functoolsupdate_wrapper_obj_WrapperBase__cachepartial_WrapperBase__keyr   _WrapperBase__lock_WrapperBase__cond)selfobjmethodcachekeylockconds          r   __init__z_WrapperBase.__init__!   sf    c4 +  v.	&&sC0
".dE".dEr   c                     t               r   NotImplementedErrorr#   argskwargss      r   __call__z_WrapperBase.__call__+       !##r   c                     t               r   r,   r#   s    r   cache_clearz_WrapperBase.cache_clear.   r2   r   c                 8    | j                  | j                        S r   )r   r   r4   s    r   r&   z_WrapperBase.cache1   s    ||DII&&r   c                     | j                   S r   )r    r4   s    r   	cache_keyz_WrapperBase.cache_key5   s    zzr   c                 8    | j                  | j                        S r   )r!   r   r4   s    r   
cache_lockz_WrapperBase.cache_lock9       {{499%%r   c                 8    | j                  | j                        S r   )r"   r   r4   s    r   cache_conditionz_WrapperBase.cache_condition=   r;   r   )NN)__name__
__module____qualname____doc__r*   r1   r5   propertyr&   r8   r:   r=   r   r   r   r   r      sd    N:$$ ' '   & & & &r   r   c                   &    e Zd ZdZddZd ZddZy)_DescriptorBasezADescriptor base class implementing the basic descriptor protocol.c                      d | _         || _        y r   )_DescriptorBase__attrname_DescriptorBase__deprecated)r#   
deprecateds     r   r*   z_DescriptorBase.__init__E   s    &r   c                     | j                   || _         y || j                   k7  rt        d| j                   d|d      y )Nz=Cannot assign the same @cachedmethod to two different names (z and z).)rF   	TypeError)r#   ownernames      r   __set_name__z_DescriptorBase.__set_name__I   sM    ??""DOT__$OO&eD827  %r   Nc                 4   | j                  |      }|	 |S | j                  )	 |j                  j                  | j                  |      }|S | j                  r	 |S d}t        |      d # t        $ rO dt        |      j                  d| j                  d}| j                  rt        |d       nt        |      d Y |S t        $ rO dt        |      j                  d| j                  d}| j                  rt        |d       nt        |      d Y |S w xY w)NzNo '__dict__' attribute on z instance to cache z
 property.   zThe '__dict__' attribute on z7 instance does not support item assignment for caching zDCannot use @cachedmethod instance without calling __set_name__ on it)
WrapperrF   __dict__
setdefaultAttributeErrorr   r>   rG   r   rJ   )r#   r$   objtypewrapperr   s        r   __get__z_DescriptorBase.__get__R   sS   ,,s#; @ ? __(3 ,,11$//7K4    YCC.d*1 " 	3 2$s)2D2D1G H))-(;:G  $$'Q/#C.d2 0$   	32493E3E2H I#1= 
 $$'Q/#C.d2 0 	3s   &A) )AD ADD)Fr   )r>   r?   r@   rA   r*   rM   rV   r   r   r   rD   rD   B   s    K'&r   rD   c                   .     e Zd ZdZ fdZd Zd Z xZS )_DeprecatedDescriptorBasez=Descriptor base class supporting deprecated @classmethod use.c                 B    t         |   d       || _        || _        y )NT)rH   )superr*   "_DeprecatedDescriptorBase__wrapper&_DeprecatedDescriptorBase__cache_clear)r#   rU   r5   	__class__s      r   r*   z"_DeprecatedDescriptorBase.__init__~   s"    D) (r   c                 >    t        d        | j                  |i |S NrO   r   )r   r[   r.   s      r   r1   z"_DeprecatedDescriptorBase.__call__   s     Q't~~t.v..r   c                 <    t        d       | j                  |      S r_   )r   r\   )r#   rT   s     r   r5   z%_DeprecatedDescriptorBase.cache_clear   s    Q'!!'**r   )r>   r?   r@   rA   r*   r1   r5   __classcell__)r]   s   @r   rX   rX   {   s    G)/
+r   rX   c                 H      G  fddt               } |       S )Nc                   2    e Zd Z G  fdde      Zy)#_condition_info.<locals>.Descriptorc                   D     e Zd Z fdZfdZd ZfdZ xZS )+_condition_info.<locals>.Descriptor.Wrapperc                 h    t         |   |       dx| _        | _        t	               | _        y Nr   )rZ   r*   _Wrapper__hits_Wrapper__missesset_Wrapper__pendingr#   r$   r]   r&   r)   r'   r(   r%   s     r   r*   z4_condition_info.<locals>.Descriptor.Wrapper.__init__   s1     feS$E.//dm!$r   c                      j                   } j                  } j                  }  j                  |i ||5  |j	                   fd       	 |   } xj
                  dz  c_        |cd d d        S # t        $ r3  j                  j                          xj                  dz  c_	        Y nw xY w	 d d d        n# 1 sw Y   nxY w	  	 j                  g|i |}|5  	 ||<   n# t        $ r Y nw xY w|cd d d        |5   j                  j                         |j                          d d d        S # 1 sw Y   S xY w# 1 sw Y   nxY w	 |5   j                  j                         |j                          d d d        y # 1 sw Y   y xY w# |5   j                  j                         |j                          d d d        w # 1 sw Y   w xY wxY w)Nc                        j                   vS r   )rl   )r'   r#   s   r   <lambda>zF_condition_info.<locals>.Descriptor.Wrapper.__call__.<locals>.<lambda>   s    #T^^*C r      )r&   r:   r=   r8   wait_forri   KeyErrorrl   addrj   r   
ValueErrorremove
notify_all)
r#   r/   r0   r&   r(   r)   resultvalr'   r%   s
   `       @r   r1   z4_condition_info.<locals>.Descriptor.Wrapper.__call__   s   

++$dnnd5f5 +MM"CD+!&sq(%+ + $ +**3/*+%+ + +* <T<V<C #!),E#J) ! !"# #  *--c2)* * *# # #  *--c2)* * * *--c2)* * *s   CA889B41C3B44CC
F &E
(C.-E
.	C:7E
9C::E
>	F 	,D>>E	
EF ,FFG,G		GGGc                     | j                   5  | j                  j                          dx| _        | _        d d d        y # 1 sw Y   y xY wrh   r:   r&   clearri   rj   r4   s    r   r5   z7_condition_info.<locals>.Descriptor.Wrapper.cache_clear   <    __ 4JJ$$&233DK$-4 4 4	   )?Ac                     | j                   5   | j                  | j                  | j                        cd d d        S # 1 sw Y   y xY wr   r:   r&   ri   rj   r#   infos    r   
cache_infoz6_condition_info.<locals>.Descriptor.Wrapper.cache_info   ;    __ H

DKKGH H H   (A  A	r>   r?   r@   r*   r1   r5   r   ra   )r]   r&   r)   r   r'   r(   r%   s   @r   rP   rf      s#    ' '
*84
H Hr   rP   Nr>   r?   r@   r   rP   )r&   r)   r   r'   r(   r%   s   r   
Descriptorrd      s    )	H )	Hl )	Hr   r   rD   )r%   r&   r'   r(   r)   r   r   s   `````` r   _condition_infor      s"    *H *H_ *HX <r   c                 D      G  fddt               } |       S )Nc                   0    e Zd Z G  fdde      Zy) _locked_info.<locals>.Descriptorc                   B     e Zd Z fdZfdZd ZfdZ xZS )(_locked_info.<locals>.Descriptor.Wrapperc                 H    t         |   |       dx| _        | _        y rh   rZ   r*   ri   rj   r#   r$   r]   r&   r'   r(   r%   s     r   r*   z1_locked_info.<locals>.Descriptor.Wrapper.__init__   s&     feS$?.//dmr   c                    | j                   }| j                  } | j                  |i |}|5  	 ||   }| xj                  dz  c_        |cd d d        S # t        $ r | xj
                  dz  c_        Y nw xY w	 d d d        n# 1 sw Y   nxY w | j                  g|i |}|5  	 |j                  ||      cd d d        S # t        $ r |cY cd d d        S w xY w# 1 sw Y   y xY wNrq   )	r&   r:   r8   ri   rs   rj   r   rR   ru   )	r#   r/   r0   r&   r(   r'   rx   ry   r%   s	           r   r1   z1_locked_info.<locals>.Descriptor.Wrapper.__call__   s    

$dnnd5f5 ++!&sq(%	+ +
 $ +*+%+ + + TYY888 ##  %//S9# # & #"
# ### #sR   BAA63B5A66BB'C)CCCCCC'c                     | j                   5  | j                  j                          dx| _        | _        d d d        y # 1 sw Y   y xY wrh   r{   r4   s    r   r5   z4_locked_info.<locals>.Descriptor.Wrapper.cache_clear   r}   r~   c                     | j                   5   | j                  | j                  | j                        cd d d        S # 1 sw Y   y xY wr   r   r   s    r   r   z3_locked_info.<locals>.Descriptor.Wrapper.cache_info   r   r   r   )r]   r&   r   r'   r(   r%   s   @r   rP   r      s#    0 0#*4
H Hr   rP   Nr   )r&   r   r'   r(   r%   s   r   r   r      s    !	H !	Hl !	Hr   r   r   )r%   r&   r'   r(   r   r   s   ````` r   _locked_infor      s"    "H "H_ "HH <r   c                 @      G  fddt               } |       S )Nc                   .    e Zd Z G  fdde      Zy)"_unlocked_info.<locals>.Descriptorc                   @     e Zd Z fdZfdZd ZfdZ xZS )*_unlocked_info.<locals>.Descriptor.Wrapperc                 F    t         |   |       dx| _        | _        y rh   r   r#   r$   r]   r&   r'   r%   s     r   r*   z3_unlocked_info.<locals>.Descriptor.Wrapper.__init__   s$     feS9.//dmr   c                    | j                   } | j                  |i |}	 ||   }| xj                  dz  c_        |S # t        $ r | xj                  dz  c_        Y nw xY w | j
                  g|i |}	 |||<   |S # t        $ r Y |S w xY wr   )r&   r8   ri   rs   rj   r   ru   )r#   r/   r0   r&   r'   rx   ry   r%   s          r   r1   z3_unlocked_info.<locals>.Descriptor.Wrapper.__call__   s    

$dnnd5f5'"3ZFKK1$K!M 'MMQ&M'TYY888!$E#J 
 " 
s!   = AA8A? ?	BBc                 T    | j                   j                          dx| _        | _        y rh   )r&   r|   ri   rj   r4   s    r   r5   z6_unlocked_info.<locals>.Descriptor.Wrapper.cache_clear  s     

  ".//dmr   c                 T     | j                   | j                  | j                        S r   )r&   ri   rj   r   s    r   r   z5_unlocked_info.<locals>.Descriptor.Wrapper.cache_info  s    DJJT]]CCr   r   )r]   r&   r   r'   r%   s   @r   rP   r      s    0 0D Dr   rP   Nr   )r&   r   r'   r%   s   r   r   r      s    	D 	Dl 	Dr   r   r   )r%   r&   r'   r   r   s   ```` r   _unlocked_infor      s!    D D_ D: <r   c           	          	 t        j                          fd	fd	fd} G  	fddt              } ||      S )Nc                 .    |       } 	| g|i | 
|       5   |       j                  fd       	 |   cd d d        S # t        $ r j                         Y nw xY w	 d d d        n# 1 sw Y   nxY w	  | g|i |} 
|       5  	 ||<   n# t        $ r Y nw xY w|cd d d         
|       5  j	                          |       j                          d d d        S # 1 sw Y   S xY w# 1 sw Y   nxY w	  
|       5  j	                          |       j                          d d d        y # 1 sw Y   y xY w#  
|       5  j	                          |       j                          d d d        w # 1 sw Y   w xY wxY w)Nc                       vS r   r   )kpendings   r   rp   z-_condition.<locals>.wrapper.<locals>.<lambda>  s    (8 r   )rr   rs   rt   ru   rv   rw   )r#   r   r/   r0   cvr   r&   r)   r'   r(   r%   s    `    @r   rU   z_condition.<locals>.wrapper  s   $K&t&v&$Z 	J 89t	 	  A	 	 		(t-d-f-Ad AaD!   d (q!T
%%'( ( (   d (q!T
%%'( ( (d (q!T
%%'( ( (s   A5AA(%A5'A((A55A>E C<BC<	B*'C<)B**C<.	E ?(C00C9	<DE (EE	F(F?	FFFc                 p     |       } |       5  |j                          d d d        y # 1 sw Y   y xY wr   r|   r#   r   r&   r(   s     r   r5   z_condition.<locals>.cache_clear'  1    $K$Z 	GGI	 	 	   ,5c                 R    j                  | t                     } | |g|i |S r   )rR   rk   )r#   r/   r0   pr   rU   s       r   classmethod_wrapperz'_condition.<locals>.classmethod_wrapper,  s.    tSU+tQ0000r   c            	       4    e Zd Z G  fdde      Zy)_condition.<locals>.Descriptorc                   @     e Zd Z fdZfdZdfd	Z xZS )&_condition.<locals>.Descriptor.Wrapperc                 L    t         |   |       t               | _        y r   )rZ   r*   rk   rl   rm   s     r   r*   z/_condition.<locals>.Descriptor.Wrapper.__init__2  s#     feS$E!$r   c                 F     | j                   | j                  g|i |S r   )r   rl   r#   r/   r0   rU   s      r   r1   z/_condition.<locals>.Descriptor.Wrapper.__call__6  s"    tyy$..J4J6JJr   c                 (     | j                         S r   r   r#   _objtyper5   s     r   r5   z2_condition.<locals>.Descriptor.Wrapper.cache_clear:      "499--r   r   r>   r?   r@   r*   r1   r5   ra   )r]   r&   r5   r)   r'   r(   r%   rU   s   @r   rP   r   1  s    ' 'K. .r   rP   Nr   )r&   r5   r)   r'   r(   r%   rU   s   r   r   r   0  s    
	. 
	.l 
	.r   r   )weakrefWeakKeyDictionaryrX   )
r%   r&   r'   r(   r)   r   r   r5   r   rU   s
   `````  @@@r   
_conditionr     sG    '')G( (,
1. .. . );77r   c                 h      fdfd G  fddt               } |      S )Nc                 T    |       } | g|i |} |       5  	 ||   cd d d        S # t         $ r Y nw xY w	 d d d        n# 1 sw Y   nxY w 	| g|i |} |       5  	 |j                  ||      cd d d        S # t        $ r |cY cd d d        S w xY w# 1 sw Y   y xY wr   )rs   rR   ru   )
r#   r/   r0   r   r   r   r&   r'   r(   r%   s
         r   rU   z_locked.<locals>.wrapperA  s    $K&t&v&$Z 	t	 	  		 	 	
 4)$)&)$Z 	 ||Aq)	 	  	 		 	sK   A.	:A:AA'B)BBBBBB'c                 p     |       } |       5  |j                          d d d        y # 1 sw Y   y xY wr   r   r   s     r   r5   z_locked.<locals>.cache_clearS  r   r   c                   2    e Zd Z G  fdde      Zy)_locked.<locals>.Descriptorc                   >     e Zd Z fdZfdZdfd	Z xZS )#_locked.<locals>.Descriptor.Wrapperc                 ,    t         |   |       y r   rZ   r*   r   s     r   r*   z,_locked.<locals>.Descriptor.Wrapper.__init__Z  s     feS$?r   c                 0     | j                   g|i |S r   r   r   s      r   r1   z,_locked.<locals>.Descriptor.Wrapper.__call__]      tyy:4:6::r   c                 (     | j                         S r   r   r   s     r   r5   z/_locked.<locals>.Descriptor.Wrapper.cache_cleara  r   r   r   r   )r]   r&   r5   r'   r(   r%   rU   s   @r   rP   r   Y  s    @ @;. .r   rP   Nr   )r&   r5   r'   r(   r%   rU   s   r   r   r   X  s    		. 		.l 		.r   r   rX   )r%   r&   r'   r(   r   r5   rU   s   ```` @@r   _lockedr   @  s.    $

. 
.. 
. g{++r   c                 `      fdfd G  fddt               } |      S )Nc                      |       } | g|i |}	 ||   S # t         $ r Y nw xY w | g|i |}	 |||<   |S # t        $ r Y |S w xY wr   )rs   ru   )	r#   r/   r0   r   r   r   r&   r'   r%   s	         r   rU   z_unlocked.<locals>.wrapperh  s    $K&t&v&	Q4K 		4)$)&)	AaD   		s    	((? 	AAc                 6     |       }|j                          y r   r   )r#   r   r&   s     r   r5   z_unlocked.<locals>.cache_clearv  s    $K		r   c                   0    e Zd Z G  fdde      Zy)_unlocked.<locals>.Descriptorc                   <     e Zd Z fdZfdZdfd	Z xZS )%_unlocked.<locals>.Descriptor.Wrapperc                 *    t         |   |       y r   r   r   s     r   r*   z._unlocked.<locals>.Descriptor.Wrapper.__init__|  s     feS9r   c                 0     | j                   g|i |S r   r   r   s      r   r1   z._unlocked.<locals>.Descriptor.Wrapper.__call__  r   r   c                 (     | j                         S r   r   r   s     r   r5   z1_unlocked.<locals>.Descriptor.Wrapper.cache_clear  r   r   r   r   )r]   r&   r5   r'   r%   rU   s   @r   rP   r   {  s    :;. .r   rP   Nr   )r&   r5   r'   r%   rU   s   r   r   r   z  s    		. 		.l 		.r   r   r   )r%   r&   r'   r   r5   rU   s   ``` @@r   	_unlockedr   g  s.    
. 
.. 
. g{++r   c                    |I||t        | |||||      }nx|t        | |||||      }ne|t        | ||||      }nSt        | |||      }nD||t        | ||||      }n0|t        | ||||      }n|t	        | |||      }nt        | ||      }||_        ||_        ||n||_        ||_	        t        j                  ||       S r   )r   r   r   r   r   r   r&   r8   r:   r=   r   r   )r%   r&   r'   r(   r)   r   rU   s          r   _wrapperr     s     0%feS$dKG%feS$dKG"65#tTBG$VUC>G 0 T4@G T4@GfeS$7Gs3G GMG!%!1tG"G##GV44r   )NNN)rA   __all__r   r   r   r   r   r   r   rD   rX   r   r   r   r   r   r   r   r   r   r   <module>r      sp    
   !& !&H6 6r+ +2-`%PB08f$,N,D5r   