
    `i66                         d Z dZddlZddlZddl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dS )zMethod decorator helpers.     Nc                 >    t          j        dt          |            d S )Nz9decorating class methods with @cachedmethod is deprecated
stacklevelwarningswarnDeprecationWarningr   s    l/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/cachetools/_cachedmethod.py_warn_classmethodr   
   s.    MC         c                 >    t          j        | t          |           d S )Nr   r   )msgr   s     r   _warn_instance_dictr      s.    M     r   c                   ~    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dS )_WrapperBasezDWrapper base class providing default implementations for properties.Nc                     t          |t                    rt          d           t          j        | |           || _        || _        || _        || _        || _	        d S )N   r   )

isinstancetyper   	functoolsupdate_wrapper_obj_WrapperBase__cache_WrapperBase__key_WrapperBase__lock_WrapperBase__cond)selfobjmethodcachekeylockconds          r   __init__z_WrapperBase.__init__   s_    c4   	,++++ v...	
r   c                     t                      NNotImplementedErrorr   argskwargss      r   __call__z_WrapperBase.__call__'       !###r   c                     t                      r'   r(   r   s    r   cache_clearz_WrapperBase.cache_clear*   r.   r   c                 6    |                      | j                  S r'   )r   r   r0   s    r   r!   z_WrapperBase.cache-   s    ||DI&&&r   c                     | j         S r'   )r   r0   s    r   	cache_keyz_WrapperBase.cache_key1   s
    zr   c                 H    | j         d n|                      | j                  S r'   )r   r   r0   s    r   
cache_lockz_WrapperBase.cache_lock5   !    {*ttDI0F0FFr   c                 H    | j         d n|                      | j                  S r'   )r   r   r0   s    r   cache_conditionz_WrapperBase.cache_condition9   r7   r   )NN)__name__
__module____qualname____doc__r%   r-   r1   propertyr!   r4   r6   r9   r   r   r   r   r      s        NN   $ $ $$ $ $ ' ' X'   X G G XG G G XG G Gr   r   c                   (    e Zd ZdZddZd ZddZdS )	_DescriptorBasezADescriptor base class implementing the basic descriptor protocol.Fc                 "    d | _         || _        d S r'   )_DescriptorBase__attrname_DescriptorBase__deprecated)r   
deprecateds     r   r%   z_DescriptorBase.__init__A   s    &r   c                 r    | j         	|| _         d S || j         k    rt          d| j         d|d          d S )Nz=Cannot assign the same @cachedmethod to two different names (z and z).)rB   	TypeError)r   ownernames      r   __set_name__z_DescriptorBase.__set_name__E   sb    ?""DOOOT_$$7O7 7,07 7 7   %$r   Nc                    |                      |          }| j        	 |j                            | j        |          }n# t          $ rK dt          |          j        d| j        d}| j        rt          |d           nt          |          d Y nqt          $ rK dt          |          j        d| j        d}| j        rt          |d           nt          |          d Y nw xY w| j        rnd}t          |          d |S )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)
WrapperrB   __dict__
setdefaultAttributeErrorr   r:   rC   r   rF   )r   r   objtypewrapperr   s        r   __get__z_DescriptorBase.__get__N   sl   ,,s##?&3 ,11$/7KK! 	3 	3 	3G$s))2D G G)-G G G  $ 3'Q////#C..d2 0/  	3 	3 	3=4993E = =#= = = 
 $ 3'Q////#C..d2 0/	3  	+XCC..d*s    ? AC'AC'&C')Fr'   )r:   r;   r<   r=   r%   rI   rR   r   r   r   r@   r@   >   sQ        KK' ' ' '  ! ! ! ! ! !r   r@   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                 h    t                                          d           || _        || _        d S )NT)rD   )superr%   "_DeprecatedDescriptorBase__wrapper&_DeprecatedDescriptorBase__cache_clear)r   rQ   r1   	__class__s      r   r%   z"_DeprecatedDescriptorBase.__init__u   s3    D))) (r   c                 <    t          d            | j        |i |S NrK   r   )r   rW   r*   s      r   r-   z"_DeprecatedDescriptorBase.__call__{   s*    Q''''t~t.v...r   c                 L    t          d           |                     |          S r[   )r   rX   )r   rP   s     r   r1   z%_DeprecatedDescriptorBase.cache_clear   s'    Q''''!!'***r   )r:   r;   r<   r=   r%   r-   r1   __classcell__)rY   s   @r   rT   rT   r   s\        GG) ) ) ) )/ / /
+ + + + + + +r   rT   c                 V      G  fddt                     } |            S )Nc                   :    e Zd Z G  fdde          ZdS )#_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                     t                                          |           dx| _        | _        t	                      | _        d S Nr   )rV   r%   _Wrapper__hits_Wrapper__missesset_Wrapper__pendingr   r   rY   r!   r$   r"   r#   r    s     r   r%   z4_condition_info.<locals>.Descriptor.Wrapper.__init__   sB      feS$EEE.//dm!$r   c                      j         } j        } j        }  j         j        g|R i ||5  |                     fd           	 |         } xj        dz  c_        |cd d d            S # t          $ r-  j        	                                xj
        dz  c_
        Y nw xY w	 d d d            n# 1 swxY w Y   	  	 j        g|R i |}|5  	 ||<   n# t          $ r Y nw xY w|cd d d            |5   j                                       |                                 d d d            S # 1 swxY w Y   S # 1 swxY w Y   	 |5   j                                       |                                 d d d            d S # 1 swxY w Y   d S # |5   j                                       |                                 d d d            w # 1 swxY w Y   w xY w)Nc                       j         vS r'   )rh   )r"   r   s   r   <lambda>zF_condition_info.<locals>.Descriptor.Wrapper.__call__.<locals>.<lambda>   s    #T^*C r      )r!   r6   r9   r4   r   wait_forre   KeyErrorrh   addrf   
ValueErrorremove
notify_all)
r   r+   r,   r!   r#   r$   resultvalr"   r    s
   `       @r   r-   z4_condition_info.<locals>.Descriptor.Wrapper.__call__   s   
+$dnTY@@@@@@ + +MM"C"C"C"C"CDDD+!&sq(%+ + + + + + + + $ + + +**3///*+%+ + + + + + + + + + + + + + +* &<T<<<V<<C # #!),E#JJ) ! ! ! D!"# # # # # # #  * *--c222)))* * * * * * * * * * * * * * * *# # # # # # # # #  * *--c222)))* * * * * * * * * * * * * * * * * * * *--c222)))* * * * * * * * * * * * * * * *s   B9A224B)&B9(B))B99B= B=F EC E 
C-*E,C--E1F ?/D::D>	D>	E

F E
F /FFFG' /GG'GG'"G#G'c                     | j         5  | j                                         dx| _        | _        d d d            d S # 1 swxY w Y   d S rd   r6   r!   clearre   rf   r0   s    r   r1   z7_condition_info.<locals>.Descriptor.Wrapper.cache_clear       _ 4 4J$$&&&233DK$-4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4   (=AAc                 ~    | j         5   | j        | j        | j                  cd d d            S # 1 swxY w Y   d S r'   r6   r!   re   rf   r   infos    r   
cache_infoz6_condition_info.<locals>.Descriptor.Wrapper.cache_info       _ H H4
DKGGH H H H H H H H H H H H H H H H H H   266r:   r;   r<   r%   r-   r1   r   r]   )rY   r!   r$   r~   r"   r#   r    s   @r   rL   rb      s        ' ' ' ' ' ' ' ' ' '
* * * * *84 4 4
H H H H H H H H Hr   rL   Nr:   r;   r<   r   rL   )r!   r$   r~   r"   r#   r    s   r   
Descriptorr`      ss        )	H )	H )	H )	H )	H )	H )	H )	H )	H )	H )	H )	Hl )	H )	H )	H )	H )	Hr   r   r@   )r    r!   r"   r#   r$   r~   r   s   `````` r   _condition_infor      ss    *H *H *H *H *H *H *H *H *H *H *H *H_ *H *H *HX :<<r   c                 R      G  fddt                     } |            S )Nc                   8    e Zd Z G  fdde          ZdS ) _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                 n    t                                          |           dx| _        | _        d S rd   rV   r%   re   rf   r   r   rY   r!   r"   r#   r    s     r   r%   z1_locked_info.<locals>.Descriptor.Wrapper.__init__   s5      feS$???.//dmmmr   c                    | j         }| j        } | j        | j        g|R 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xY w Y    | j        g|R i |}|5  	 |                    ||          cd d d            S # t          $ r |cY cd d d            S w xY w# 1 swxY w Y   d S Nrm   )	r!   r6   r4   r   re   ro   rf   rN   rq   )	r   r+   r,   r!   r#   r"   rt   ru   r    s	           r   r-   z1_locked_info.<locals>.Descriptor.Wrapper.__call__   s   
$dnTY@@@@@@ + ++!&sq(%	+ + + + + + + +
 $ + + +*+%+ + + + + + + + + + + + + + + fTY888888 # ##  %//S99# # # # # # # # & # # #"

# # # # # # # ### # # # # # # # # #s^   A=AA-*A=,A--A==BBCB??CCCCC!$C!c                     | j         5  | j                                         dx| _        | _        d d d            d S # 1 swxY w Y   d S rd   rw   r0   s    r   r1   z4_locked_info.<locals>.Descriptor.Wrapper.cache_clear   ry   rz   c                 ~    | j         5   | j        | j        | j                  cd d d            S # 1 swxY w Y   d S r'   r|   r}   s    r   r   z3_locked_info.<locals>.Descriptor.Wrapper.cache_info   r   r   r   )rY   r!   r~   r"   r#   r    s   @r   rL   r      s        0 0 0 0 0 0 0 0 0# # # # #*4 4 4
H H H H H H H H Hr   rL   Nr   )r!   r~   r"   r#   r    s   r   r   r      sm        !	H !	H !	H !	H !	H !	H !	H !	H !	H !	H !	Hl !	H !	H !	H !	H !	Hr   r   r   )r    r!   r"   r#   r~   r   s   ````` r   _locked_infor      sl    "H "H "H "H "H "H "H "H "H "H "H_ "H "H "HH :<<r   c                 N      G  fddt                     } |            S )Nc                   6    e Zd Z G  fdde          ZdS )"_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                 l    t                                          |           dx| _        | _        d S rd   r   r   r   rY   r!   r"   r    s     r   r%   z3_unlocked_info.<locals>.Descriptor.Wrapper.__init__   s3      feS999.//dmmmr   c                    | j         } | j        | j        g|R i |}	 ||         }| xj        dz  c_        |S # t          $ r | xj        dz  c_        Y nw xY w | j        g|R i |}	 |||<   n# t          $ r Y nw xY w|S r   )r!   r4   r   re   ro   rf   rq   )r   r+   r,   r!   r"   rt   ru   r    s          r   r-   z3_unlocked_info.<locals>.Descriptor.Wrapper.__call__   s    
$dnTY@@@@@@'"3ZFKK1$KK!M ' ' 'MMQ&MMMM'fTY888888!$E#JJ!   D
s!   : AA,A2 2
A?>A?c                 T    | j                                          dx| _        | _        d S rd   )r!   rx   re   rf   r0   s    r   r1   z6_unlocked_info.<locals>.Descriptor.Wrapper.cache_clear   s(    
  """.//dmmmr   c                 <     | j         | j        | j                  S r'   )r!   re   rf   r}   s    r   r   z5_unlocked_info.<locals>.Descriptor.Wrapper.cache_info   s    tDJT]CCCr   r   )rY   r!   r~   r"   r    s   @r   rL   r      s        0 0 0 0 0 0 0 0     0 0 0D D D D D D D D Dr   rL   Nr   )r!   r~   r"   r    s   r   r   r      sg        	D 	D 	D 	D 	D 	D 	D 	D 	D 	Dl 	D 	D 	D 	D 	Dr   r   r   )r    r!   r"   r~   r   s   ```` r   _unlocked_infor      sd    D D D D D D D D D D_ D D D: :<<r   c           	          	 t          j                     fd	fd	fd} G  	fddt                    } ||          S )Nc                     |           } 	| g|R i | 
|           5   |                                fd           	 |         cd d d            S # t          $ r                                Y nw xY w	 d d d            n# 1 swxY w Y   	  | g|R i |} 
|           5  	 ||<   n# t          $ r Y nw xY w|cd d d             
|           5                                  |                                            d d d            S # 1 swxY w Y   S # 1 swxY w Y   	  
|           5                                  |                                            d d d            d S # 1 swxY w Y   d S #  
|           5                                  |                                            d d d            w # 1 swxY w Y   w xY w)Nc                       vS r'   r   )kpendings   r   rl   z-_condition.<locals>.wrapper.<locals>.<lambda>  s    (8 r   )rn   ro   rp   rq   rr   rs   )r   r   r+   r,   cvr   r!   r$   r"   r#   r    s    `    @r   rQ   z_condition.<locals>.wrapper  s   E$KKC&t&&&v&&T$ZZ 	 	DJJ 8 8 8 8 8999t	 	 	 	 	 	 	 	    A	 	 	 	 	 	 	 	 	 	 	 	 	 	 		(t-d---f--Ad  AaDD!   D       d ( (q!!!T

%%'''( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (         d ( (q!!!T

%%'''( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (d ( (q!!!T

%%'''( ( ( ( ( ( ( ( ( ( ( ( ( ( ( (s   #B
AB =B?B  BBBF 3D.5B;:D.;
CD.CD.F #3D""D&	)D&	.D22F 5D26F 3FF	F	G)3GG)G!!G)$G!%G)c                      |           } |           5  |                                  d d d            d S # 1 swxY w Y   d S r'   rx   r   r   r!   r#   s     r   r1   z_condition.<locals>.cache_clear      E$KKT$ZZ 	 	GGIII	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	   :>>c                 b                         | t                                } | |g|R i |S r'   )rN   rg   )r   r+   r,   pr   rQ   s       r   classmethod_wrapperz'_condition.<locals>.classmethod_wrapper#  s>    tSUU++wtQ0000000r   c            	       <    e Zd Z G  fdde          ZdS )_condition.<locals>.Descriptorc                   @     e Zd Z fdZfdZdfd	Z xZS )&_condition.<locals>.Descriptor.Wrapperc                 z    t                                          |           t                      | _        d S r'   )rV   r%   rg   rh   ri   s     r   r%   z/_condition.<locals>.Descriptor.Wrapper.__init__)  s4      feS$EEE!$r   c                 2     | j         | j        g|R i |S r'   )r   rh   r   r+   r,   rQ   s      r   r-   z/_condition.<locals>.Descriptor.Wrapper.__call__-  s)    wty$.J4JJJ6JJJr   Nc                 $     | j                   S r'   r   r   _objtyper1   s     r   r1   z2_condition.<locals>.Descriptor.Wrapper.cache_clear1      "{49---r   r'   r:   r;   r<   r%   r-   r1   r]   )rY   r!   r1   r$   r"   r#   r    rQ   s   @r   rL   r   (  s        ' ' ' ' ' ' ' ' ' 'K K K K K. . . . . . . . . .r   rL   Nr   )r!   r1   r$   r"   r#   r    rQ   s   r   r   r   '  sg        
	. 
	. 
	. 
	. 
	. 
	. 
	. 
	. 
	. 
	. 
	. 
	. 
	.l 
	. 
	. 
	. 
	. 
	.r   r   )weakrefWeakKeyDictionaryrT   )
r    r!   r"   r#   r$   r   r   r1   r   rQ   s
   `````  @@@r   
_conditionr     s    '))G( ( ( ( ( ( ( ( (,     
1 1 1 1 1 1. . . . . . . . . . . . .. . . . :);777r   c                 v      fdfd G  fddt                     } |          S )Nc                     |           } | g|R i |} |           5  	 ||         cd d d            S # t           $ r Y nw xY w	 d d d            n# 1 swxY w Y    	| g|R i |} |           5  	 |                    ||          cd d d            S # t          $ r |cY cd d d            S w xY w# 1 swxY w Y   d S r'   )ro   rN   rq   )
r   r+   r,   r   r   r   r!   r"   r#   r    s
         r   rQ   z_locked.<locals>.wrapper8  s   E$KKC&t&&&v&&T$ZZ 	 	t	 	 	 	 	 	 	 	    		 	 	 	 	 	 	 	 	 	 	 	 	 	 	
 F4)$)))&))T$ZZ 	 	 ||Aq))	 	 	 	 	 	 	 	    	 	 	 	 	 	 	 		 	 	 	 	 	 	 	 	 	s\   A:
AAAAAA9B;;BB8)B;7B88B;;B?B?c                      |           } |           5  |                                  d d d            d S # 1 swxY w Y   d S r'   r   r   s     r   r1   z_locked.<locals>.cache_clearJ  r   r   c                   :    e Zd Z G  fdde          ZdS )_locked.<locals>.Descriptorc                   >     e Zd Z fdZfdZdfd	Z xZS )#_locked.<locals>.Descriptor.Wrapperc                 R    t                                          |           d S r'   rV   r%   r   s     r   r%   z,_locked.<locals>.Descriptor.Wrapper.__init__Q  s)      feS$?????r   c                 &     | j         g|R i |S r'   r   r   s      r   r-   z,_locked.<locals>.Descriptor.Wrapper.__call__T  %    wty:4:::6:::r   Nc                 $     | j                   S r'   r   r   s     r   r1   z/_locked.<locals>.Descriptor.Wrapper.cache_clearX  r   r   r'   r   )rY   r!   r1   r"   r#   r    rQ   s   @r   rL   r   P  s        @ @ @ @ @ @ @ @ @; ; ; ; ;. . . . . . . . . .r   rL   Nr   )r!   r1   r"   r#   r    rQ   s   r   r   r   O  sb        		. 		. 		. 		. 		. 		. 		. 		. 		. 		. 		. 		.l 		. 		. 		. 		. 		.r   r   rT   )r    r!   r"   r#   r   r1   rQ   s   ```` @@r   _lockedr   7  s           $     

. 
. 
. 
. 
. 
. 
. 
. 
. 
. 
. 
.. 
. 
. 
. :g{+++r   c                 n      fdfd G  fddt                     } |          S )Nc                      |           } | g|R i |}	 ||         S # t           $ r Y nw xY w | g|R i |}	 |||<   n# t          $ r Y nw xY w|S r'   )ro   rq   )	r   r+   r,   r   r   r   r!   r"   r    s	         r   rQ   z_unlocked.<locals>.wrapper_  s    E$KKC&t&&&v&&	Q4K 	 	 	D	F4)$)))&))	AaDD 	 	 	D	s   " 
//A 
AAc                 F     |           }|                                  d S r'   r   )r   r   r!   s     r   r1   z_unlocked.<locals>.cache_clearm  s!    E$KK						r   c                   8    e Zd Z G  fdde          ZdS )_unlocked.<locals>.Descriptorc                   <     e Zd Z fdZfdZdfd	Z xZS )%_unlocked.<locals>.Descriptor.Wrapperc                 P    t                                          |           d S r'   r   r   s     r   r%   z._unlocked.<locals>.Descriptor.Wrapper.__init__s  s'      feS99999r   c                 &     | j         g|R i |S r'   r   r   s      r   r-   z._unlocked.<locals>.Descriptor.Wrapper.__call__v  r   r   Nc                 $     | j                   S r'   r   r   s     r   r1   z1_unlocked.<locals>.Descriptor.Wrapper.cache_clearz  r   r   r'   r   )rY   r!   r1   r"   r    rQ   s   @r   rL   r   r  s        : : : : : : : :; ; ; ; ;. . . . . . . . . .r   rL   Nr   )r!   r1   r"   r    rQ   s   r   r   r   q  s]        		. 		. 		. 		. 		. 		. 		. 		. 		. 		. 		.l 		. 		. 		. 		. 		.r   r   r   )r    r!   r"   r   r1   rQ   s   ``` @@r   	_unlockedr   ^  s              
. 
. 
. 
. 
. 
. 
. 
. 
. 
. 
.. 
. 
. 
. :g{+++r   c                    |Y||t          | |||||          }n|t          | |||||          }n}|t          | ||||          }ngt          | |||          }nT||t          | ||||          }n<|t          | ||||          }n&|t	          | |||          }nt          | ||          }||_        ||_        ||n||_        ||_	        t          j        ||           S r'   )r   r   r   r   r   r   r!   r4   r6   r9   r   r   )r    r!   r"   r#   r$   r~   rQ   s          r   _wrapperr     s%    0%feS$dKKGG%feS$dKKGG"65#tTBBGG$VUC>>GG 0 T4@@GG T4@@GGfeS$77GGs33G GMG!%!1tG"G#GV444r   )NNN)r=   __all__r   r   r   r   r   r   r@   rT   r   r   r   r   r   r   r   r   r   r   <module>r      sN    
          !G !G !G !G !G !G !G !GH1 1 1 1 1 1 1 1h+ + + + + + + +2- - -`% % %P  B08 08 08f$, $, $,N, , ,D5 5 5 5 5 5r   