ó
    Ð]j_  ã                   ó†   • S r SSKJr  SSKJr  \" 5       r\" 5       r\SS4S jr\4S jr	\4S jr
S r " S	 S
\5      rS rg)z³
- the popular ``_memoize_default`` works like a typical memoize and returns the
  default otherwise.
- ``CachedMetaClass`` uses ``_memoize_default`` to do the same with classes.
é    ©Úwraps)ÚdebugFc                 ó   ^ ^^• U UU4S jnU$ )a:  This is a typical memoization decorator, BUT there is one difference:
To prevent recursion it sets defaults.

Preventing recursion is in this case the much bigger use than speed. I
don't think, that there is a big speed difference, but there are many cases
where recursion could happen (think about a = b; b = a).
c                 ó   >^ • UU UU4S jnU$ )Nc                 óF  >• T	(       a  U R                   nO-T
(       a  US   R                   nOU R                  R                   n UT   nX[        UR	                  5       5      4nXT;   a  XE   $ T[
        La  TXE'   T" U /UQ70 UD6nXdU'   U$ ! [         a
    0 =UT'   n NVf = f)Nr   )Úmemoize_cacheÚinference_stateÚKeyErrorÚ	frozensetÚitemsÚ_NO_DEFAULT)ÚobjÚargsÚkwargsÚcacheÚmemoÚkeyÚrvÚdefaultÚfunctionÚinference_state_is_first_argÚsecond_arg_is_inference_states          €€€€ÚQ/home/mande/repo/quber/.venv/lib/python3.13/site-packages/jedi/inference/cache.pyÚwrapperÚ/_memoize_default.<locals>.func.<locals>.wrapper   s´   ø€ æ+Ø×)Ñ)‘Þ.Ø˜Q™×-Ñ-‘à×+Ñ+×9Ñ9�ð,Ø˜X‘�ð œi¨¯©«Ó7Ð8ˆCØ‹{Ø‘yÐ à¤+Ò-Ø '�D‘IÙ˜cÐ3 DÒ3¨FÑ3�Ø�S‘	Ø�	øô ó ,Ø)+Ð+��h‘¢$ð,ús   ÁB ÂB ÂB © )r   r   r   r   r   s   ` €€€r   ÚfuncÚ_memoize_default.<locals>.func   s   ù€ ÷	ð 	ð. ˆó    r   )r   r   r   r   s   ``` r   Ú_memoize_defaultr!      s   ú€ ÷ð4 €Kr    c                 ó   ^ • U 4S jnU$ )Nc                 ó$   >• [        TSS9" U 5      $ )NT)r   r   ©r!   ©r   r   s    €r   Ú	decoratorÚ1inference_state_function_cache.<locals>.decorator5   s   ø€ Ü¨ÈdÒSÐTXÓYÐYr    r   ©r   r&   s   ` r   Úinference_state_function_cacher)   4   s   ø€ õZð Ðr    c                 ó   ^ • U 4S jnU$ )Nc                 ó"   >• [        TS9" U 5      $ )N)r   r$   r%   s    €r   r&   Ú/inference_state_method_cache.<locals>.decorator<   s   ø€ Ü¨Ò0°Ó6Ð6r    r   r(   s   ` r   Úinference_state_method_cacher-   ;   s   ø€ õ7ð Ðr    c                  ó   • S n U $ )Nc                 ó    • [        SS9" U 5      $ )NT)r   r$   )Úcalls    r   r&   Ú8inference_state_as_method_param_cache.<locals>.decoratorC   s   € Ü¸dÒCÀDÓIÐIr    r   )r&   s    r   Ú%inference_state_as_method_param_cacher2   B   s   € òJð Ðr    c                   ó@   ^ • \ rS rSrSr\" 5       U 4S j5       rSrU =r$ )ÚCachedMetaClasséI   zÎ
This is basically almost the same than the decorator above, it just caches
class initializations. Either you do it this way or with decorators, but
with decorators you lose class access (isinstance, etc).
c                 ó$   >• [         TU ]  " U0 UD6$ )N)ÚsuperÚ__call__)Úselfr   r   Ú	__class__s      €r   r8   ÚCachedMetaClass.__call__O   s   ø€ ä‰wÒ Ð0¨Ñ0Ð0r    r   )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r2   r8   Ú__static_attributes__Ú__classcell__)r:   s   @r   r4   r4   I   s   ø† ññ
 +Ó,ô1ó -ö1r    r4   c                  ó   • S n U $ )z�
This is a special memoizer. It memoizes generators and also checks for
recursion errors and returns no further iterator elemends in that case.
c                 ó0   ^ • [        T 5      U 4S j5       nU$ )Nc              ?   óè  >#   • U R                   R                  n UT
   nX[        UR	                  5       5      4nXT;   a  XE   u  pgOT
" U /UQ70 UD6n/ nXg4XE'   Sn  Xx   n	U	[
        L a  [        R                  " SU -  5        g  U	v •  US-  nM4  ! [         a
    0 =UT
'   n N„f = f! [         a=    UR                  [
        5        [        US 5      n	U	c  UR                  5          g X—S'    Nhf = f7f)Nr   z"Found a generator recursion for %séÿÿÿÿé   )r
   r	   r   r   r   Ú_RECURSION_SENTINELr   ÚwarningÚ
IndexErrorÚappendÚnextÚpop)r   r   r   r   r   r   Úactual_generatorÚ
cached_lstÚiÚnext_elementr   s             €r   r   ÚEinference_state_method_generator_cache.<locals>.func.<locals>.wrapperZ   s#  øé € à×'Ñ'×5Ñ5ˆEð,Ø˜X‘�ð œi¨¯©«Ó7Ð8ˆCà‹{Ø/3©yÑ,Ð  *á#+¨CÐ#A°$Ò#A¸&Ñ#AÐ Ø�
Ø,Ð8�‘	àˆAØð2Ø#-¡=�LØ#Ô':Ò:ÜŸšÐ&JÈSÑ&PÔQàð ;ð #Ò"Ø�Q‘�ñ øô ó ,Ø)+Ð+��h‘¢$ð,ûô( "ó 2Ø×%Ñ%Ô&9Ô:Ü#'Ð(8¸$Ó#?�LØ#Ñ+Ø"Ÿ™Ô(ÙØ%1˜r“Nð2üsW   ƒC2›B  =C2Á&B( ÂC2ÂB%Â"C2Â$B%Â%C2Â(>C/Ã&C2Ã(C/Ã,C2Ã.C/Ã/C2r   )r   r   s   ` r   r   Ú4inference_state_method_generator_cache.<locals>.funcY   s!   ø€ Ü	ˆx‹ô 	ó 
ð 	ðB ˆr    r   )r   s    r   Ú&inference_state_method_generator_cacherT   T   s   € ò
#ðJ €Kr    N)r@   Ú	functoolsr   Újedir   Úobjectr   rH   r!   r)   r-   r2   Útyper4   rT   r   r    r   Ú<module>rY      s[   ðñõ
 å á‹h€Ù“hÐ ð )ÀuØ38ô#ðL ,7ô ð *5ô òô1�dô 1ó*r    