Yohohohohohooho | Sanrei Aya
Sanrei Aya


Server : LiteSpeed
System : Linux barito.iixcp.rumahweb.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : elvh3918 ( 1528)
PHP Version : 8.2.31
Disable Function : mail
Directory :  /usr/local/lib/python3.9/site-packages/prompt_toolkit/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //usr/local/lib/python3.9/site-packages/prompt_toolkit/__pycache__/cache.cpython-39.pyc
a

��Sh��@s�ddlmZddlmZddlmZddlmZmZm	Z	m
Z
mZmZm
Z
mZgd�Ze
ded�Ze
d�ZGd	d
�d
e
eef�Ze
deedfd�Ze
d
�ZGdd�de	eef�Ze
dedefd�Zdddd�dd�ZdS)�)�annotations)�deque)�wraps)�Any�Callable�Dict�Generic�Hashable�Tuple�TypeVar�cast)�SimpleCache�
FastDictCache�memoized�_T)�bound�_Uc@sBeZdZdZdddd�dd�Zdd	d
d�dd
�Zdd�dd�ZdS)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.)
    ��int�None��maxsize�returncCs$|dksJ�i|_t�|_||_dS�Nr)�_datar�_keysr)�selfr�r�>/usr/local/lib/python3.9/site-packages/prompt_toolkit/cache.py�__init__szSimpleCache.__init__rzCallable[[], _U]r)�key�getter_funcrcCspz|j|WStyj|�}||j|<|j�|�t|j�|jkrb|j��}||jvrb|j|=|YS0dS)z�
        Get object from the cache.
        If not found, call `getter_func` to resolve it, and put that on the top
        of the cache instead.
        N)r�KeyErrorr�append�lenr�popleft)rr r!�value�
key_to_removerrr�get s


zSimpleCache.get�rcCsi|_t�|_dS)zClear cache.N)rrr)rrrr�clear7szSimpleCache.clearN)r)�__name__�
__module__�__qualname__�__doc__rr(r*rrrrr
sr
�_K.�_Vc@s4eZdZdZddddd�dd�Zd	d
d�dd
�ZdS)ra�
    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.
    �@BzCallable[..., _V]rr)�	get_value�sizercCs$|dksJ�t�|_||_||_dSr)rrr2r3)rr2r3rrrrVszFastDictCache.__init__r/r0)r rcCsHt|�|jkr&|j��}||vr&||=|j|�}|||<|j�|�|S�N)r$r3rr%r2r#)rr r'�resultrrr�__missing__]s

zFastDictCache.__missing__N)r1)r+r,r-r.rr6rrrrrAsr�_F�rzCallable[[_F], _F]rcsddd��fdd�}|S)zI
    Memoization decorator for immutable classes and pure functions.
    r7)�objrcs4t�d��t��dddd���fdd��}tt|�S)N�rr)�a�kwrcs6dd����fdd�}�tt�����f}��||�S)Nrr)cs��i���Sr4rr)r;r<r9rr�
create_newwszEmemoized.<locals>.decorator.<locals>.new_callable.<locals>.create_new)�tuple�sorted�itemsr()r;r<r=r ��cacher9)r;r<r�new_callableusz1memoized.<locals>.decorator.<locals>.new_callable)r
rrr7)r9rCr:rAr�	decoratorrs
zmemoized.<locals>.decoratorr)rrDrr:rrms
rN)r8)�
__future__r�collectionsr�	functoolsr�typingrrrrr	r
rr�__all__rrr
r/r0r�objectr7rrrrr�<module>s(,)

Yohohohohohooho | Sanrei Aya