ó
    NÎhï  ã                  ó  • S SK Jr  S SKJr  S SKJr  S SKJrJrJ	r	J
r
JrJrJrJr  / SQr\" S\S9r\" S5      r " S	 S
\
\\4   5      r\" S\\S4   S9r\" S5      r " S S\	\\4   5      r\" S\S\4   S9rSSS jjrg)é    )Úannotations)Údeque)Úwraps)ÚAnyÚCallableÚDictÚGenericÚHashableÚTupleÚTypeVarÚcast)ÚSimpleCacheÚFastDictCacheÚmemoizedÚ_T)ÚboundÚ_Uc                  ó:   • \ rS rSrSrSS	S jjrS
S jrSS jrSrg)r   é   z—
Very simple cache that discards the oldest item when the cache size is
exceeded.

:param maxsize: Maximum size of the cache. (Don't make it too big.)
c                óL   • US:”  d   e0 U l         [        5       U l        Xl        g ©Nr   )Ú_datar   Ú_keysÚmaxsize)Úselfr   s     ÚQ/home/mande/repo/quber/.venv/lib/python3.13/site-packages/prompt_toolkit/cache.pyÚ__init__ÚSimpleCache.__init__   s#   € Ø˜‹{Ðˆ{à#%ˆŒ
Ü %£ˆŒ
Ø#�ó    c                óX  •  U R                   U   $ ! [         aŽ    U" 5       nX0R                   U'   U R                  R                  U5        [	        U R                   5      U R
                  :”  a6  U R                  R                  5       nX@R                   ;   a  U R                   U	 Us $ f = f)zz
Get object from the cache.
If not found, call `getter_func` to resolve it, and put that on the top
of the cache instead.
)r   ÚKeyErrorr   ÚappendÚlenr   Úpopleft)r   ÚkeyÚgetter_funcÚvalueÚkey_to_removes        r   ÚgetÚSimpleCache.get    s‹   € ð	Ø—:‘:˜c‘?Ð"øÜó 	á“MˆEØ#�J‰J�s‰OØ�J‰J×Ñ˜cÔ"ô �4—:‘:‹ §¡Ó-Ø $§
¡
× 2Ñ 2Ó 4�Ø §J¡JÓ.ØŸ
™
 =Ð1àŠLð	ús   ‚ ‘BB)Â(B)c                ó0   • 0 U l         [        5       U l        g)zClear cache.N)r   r   r   )r   s    r   ÚclearÚSimpleCache.clear7   s   € àˆŒ
Ü“Wˆ�
r   )r   r   r   N)é   )r   ÚintÚreturnÚNone)r%   r   r&   zCallable[[], _U]r0   r   )r0   r1   )	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r)   r,   Ú__static_attributes__© r   r   r   r      s   † ñö$ô÷.r   r   Ú_K.Ú_Vc                  ó0   • \ rS rSrSrSSS jjrS	S jrSrg)
r   éA   aŸ  
Fast, lightweight cache which keeps at most `size` items.
It will discard the oldest items in the cache first.

The cache is a dictionary, which doesn't keep track of access counts.
It is perfect to cache little immutable objects which are not expensive to
create, but where a dictionary lookup is still much faster than an object
instantiation.

:param get_value: Callable that's called in case of a missing key.
c                óJ   • US:”  d   e[        5       U l        Xl        X l        g r   )r   r   Ú	get_valueÚsize)r   r>   r?   s      r   r   ÚFastDictCache.__init__V   s    € Ø�a‹xˆˆxä %£ˆŒ
Ø"ŒØ�	r   c                óÖ   • [        U 5      U R                  :”  a!  U R                  R                  5       nX ;   a  X	 U R                  " U6 nX0U'   U R                  R                  U5        U$ ©N)r#   r?   r   r$   r>   r"   )r   r%   r(   Úresults       r   Ú__missing__ÚFastDictCache.__missing__]   s\   € äˆt‹9�t—y‘yÓ Ø ŸJ™J×.Ñ.Ó0ˆMØÓ$ØÐ'à—’ Ð%ˆØˆS‰	Ø�
‰
×Ñ˜#ÔØˆr   )r   r>   r?   N)i@B )r>   zCallable[..., _V]r?   r/   r0   r1   )r%   r9   r0   r:   )r2   r3   r4   r5   r6   r   rD   r7   r8   r   r   r   r   A   s   † ñ
ö(÷
r   r   Ú_Fc                ó   ^ • SU 4S jjnU$ )zA
Memoization decorator for immutable classes and pure functions.
c                óh   >^ ^• [        TS9m[        T 5      SUU 4S jj5       n[        [        U5      $ )N)r   c                 ó†   >^ ^• SU UU4S jjnT [        [        TR                  5       5      5      4nTR                  X25      $ )Nc                 ó   >• T" T 0 TD6$ rB   r8   )ÚaÚkwÚobjs   €€€r   Ú
create_newÚEmemoized.<locals>.decorator.<locals>.new_callable.<locals>.create_neww   s   ø€ Ù˜A�} ‘}Ð$r   )r0   r   )ÚtupleÚsortedÚitemsr)   )rK   rL   rN   r%   ÚcacherM   s   ``  €€r   Únew_callableÚ1memoized.<locals>.decorator.<locals>.new_callableu   s8   ú€ ÷%ñ %ð ”eœF 2§8¡8£:Ó.Ó/Ð0ˆCØ—9‘9˜SÓ-Ð-r   )rK   r   rL   r   r0   r   )r   r   r   rF   )rM   rT   rS   r   s   ` @€r   Ú	decoratorÚmemoized.<locals>.decoratorr   s2   ú€ Ü,7ÀÑ,Hˆä	ˆs‹÷	.ó 
ð	.ô ”B˜Ó%Ð%r   )rM   rF   r0   rF   r8   )r   rV   s   ` r   r   r   m   s   ø€ ÷
&ð Ðr   N)i   )r   r/   r0   zCallable[[_F], _F])Ú
__future__r   Úcollectionsr   Ú	functoolsr   Útypingr   r   r   r	   r
   r   r   r   Ú__all__r   r   r   r9   r:   r   ÚobjectrF   r   r8   r   r   Ú<module>r^      s›   ðÝ "å Ý ß O× OÓ Oò€ñ ˆT˜Ñ"€ÙˆTƒ]€ô)�'˜"˜b˜&‘/ô )ñX ˆT˜˜x¨˜}Ñ-Ñ.€ÙˆTƒ]€ô&�D˜˜R˜‘Lô &ñR ˆT˜ # v +Ñ.Ñ/€÷r   