a
    hbòfÞ  ã                   @   sN   d dl mZ d dlmZmZmZ edƒZedƒZG dd„ deeef eƒZdS )é    )ÚOrderedDict)ÚDictÚGenericÚTypeVarÚCacheKeyÚ
CacheValuec                       sT   e Zd ZdZeddœ‡ fdd„Zeeddœdd„Ze	eef eed	œd
d„Z
‡  ZS )ÚLRUCachezÔ
    A dictionary-like container that stores a given maximum items.

    If an additional item is added when the LRUCache is full, the least
    recently used key is discarded to make room for the new item.

    N)Ú
cache_sizeÚreturnc                    s   || _ tt| ƒ ¡  d S )N)r	   Úsuperr   Ú__init__)Úselfr	   ©Ú	__class__© úX/home/httpd/docs/test/DocsMgr/lib/python3.9/site-packages/pip/_vendor/rich/_lru_cache.pyr      s    zLRUCache.__init__)ÚkeyÚvaluer
   c                 C   s4   || vr"t | ƒ| jkr"| jdd� t | ||¡ dS )z7Store a new views, potentially discarding an old value.F)ÚlastN)Úlenr	   Úpopitemr   Ú__setitem__©r   r   r   r   r   r   r      s    zLRUCache.__setitem__)r   r   r
   c                 C   s*   t  | |¡}t  | |¡ t  | ||¡ |S )z-Gets the item, but also makes it most recent.)r   Ú__getitem__Ú__delitem__r   r   r   r   r   r      s    zLRUCache.__getitem__)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Úintr   r   r   r   r   r   Ú__classcell__r   r   r   r   r   	   s   r   N)	Úcollectionsr   Útypingr   r   r   r   r   r   r   r   r   r   Ú<module>   s   