+
    Ri                    :   ^ RI Ht ^ RIHt ^ RIHt ^ RIHtHtH	t	H
t
HtHtHtHt . ROt]! R]R7      t]! R	4      t ! R
 R]
]]3,          4      t]! R]]R3,          R7      t]! R4      t ! R R]	]]3,          4      t]! R]R]3,          R7      tRR R lltR# )    )annotations)deque)wraps)AnyCallableDictGenericHashableTupleTypeVarcastSimpleCacheFastDictCache_T)bound_Uc                  B    ] tR t^tRtR
R R lltR R ltR R ltRtR	# )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                    V ^8  d   QhRRRR/# )   maxsizeintreturnNone )formats   "S/home/ubuntu/hermes-agent/venv/lib/python3.14/site-packages/prompt_toolkit/cache.py__annotate__SimpleCache.__annotate__   s     $ $ $D $    c                	P    V^ 8  g   Q h/ V n         \        4       V n        Wn        R# r   N)_datar   _keysr   )selfr   s   &&r   __init__SimpleCache.__init__   s#    {{#%
 %
#r   c               $    V ^8  d   QhRRRRRR/# )r   keyr   getter_funczCallable[[], _U]r   r   r   )r   s   "r   r   r       s"      r (8 R r   c                f    V P                   V,          #   \         d    T! 4       pY0P                   T&   T P                  P                  T4       \	        T P                   4      T P
                  8  d8   T P                  P                  4       pY@P                   9   d   T P                   T Tu # i ; i)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$   r(   r)   valuekey_to_removes   &&&  r   getSimpleCache.get    s    	::c?" 	ME#JJsOJJc" 4::- $

 2 2 4 JJ.

=1L	s    BB0/B0c                   V ^8  d   QhRR/# )r   r   r   r   )r   s   "r   r   r   7   s      t r   c                2    / V n         \        4       V n        R# )zClear cache.N)r"   r   r#   )r$   s   &r   clearSimpleCache.clear7   s    
W
r   )r"   r#   r   N)   )	__name__
__module____qualname____firstlineno____doc__r%   r1   r5   __static_attributes__r   r   r   r   r      s    $. r   _K._Vc                  6    ] tR t^AtRtRR R lltR R ltRtR# )	r   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               $    V ^8  d   QhRRRRRR/# )r   	get_valuezCallable[..., _V]sizer   r   r   r   )r   s   "r   r   FastDictCache.__annotate__V   s"      "3 3 T r   c                	N    V^ 8  g   Q h\        4       V n        Wn        W n        R# r!   )r   r#   rB   rC   )r$   rB   rC   s   &&&r   r%   FastDictCache.__init__V   s     axx %
"	r   c                    V ^8  d   QhRRRR/# )r   r(   r>   r   r?   r   )r   s   "r   r   rD   ]   s     
 
r 
b 
r   c                	    \        V 4      V P                  8  d#   V P                  P                  4       pW 9   d   W V P                  ! V!  pW0V&   V P                  P                  V4       V# N)r-   rC   r#   r.   rB   r,   )r$   r(   r0   results   &&  r   __missing__FastDictCache.__missing__]   s\    t9tyy  JJ..0M$'%S	

#r   )r#   rB   rC   N)i@B )r8   r9   r:   r;   r<   r%   rK   r=   r   r   r   r   r   A   s    
(
 
r   _Fc                    V ^8  d   QhRRRR/# )r   r   r   r   zCallable[[_F], _F]r   )r   s   "r   r   r   m   s      c %7 r   c                   a  R V 3R llpV# )zA
Memoization decorator for immutable classes and pure functions.
c                    V ^8  d   QhRRRR/# )r   objrM   r   r   )r   s   "r   r   memoized.<locals>.__annotate__r   s     & &r &b &r   c                p   <a a \        SR 7      o\        S 4      R VV 3R ll4       p\        \        V4      # ))r   c               $    V ^8  d   QhRRRRRR/# )r   ar   kwr   r   )r   s   "r   r   1memoized.<locals>.decorator.<locals>.__annotate__v   s!     	. 	.S 	. 	. 	.r   c                    <a a R  V VV3R llpS \        \        SP                  4       4      4      3pSP                  W24      # )c                   V ^8  d   QhRR/# )r   r   r   r   )r   s   "r   r   Gmemoized.<locals>.decorator.<locals>.new_callable.<locals>.__annotate__w   s     % % %r   c                    < S! S / SB # rI   r   )rU   rV   rQ   s   r   
create_newEmemoized.<locals>.decorator.<locals>.new_callable.<locals>.create_neww   s    A}}$r   )tuplesorteditemsr1   )rU   rV   r\   r(   cacherQ   s   jl  r   new_callable1memoized.<locals>.decorator.<locals>.new_callableu   s8    % % eF288:./0C99S--r   )r   r   r   rM   )rQ   rb   ra   r   s   f @r   	decoratormemoized.<locals>.decoratorr   s7    ,7,H	s	. 	. 
	. B%%r   r   )r   rd   s   f r   memoizedrf   m   s    
& & r   N)r   r   rf   )i   )
__future__r   collectionsr   	functoolsr   typingr   r   r   r	   r
   r   r   r   __all__r   r   r   r>   r?   r   objectrM   rf   r   r   r   <module>rm      s    "   O O O T"T])'"b&/ )X Tx}-.T]&DRL &R T#v+./ r   