U
    ƒIÀdÿ  ã                   @   sD   d Z ddlmZ G dd„ deƒZG dd„ deƒZG dd„ deƒZd	S )
zb
The cache object API for implementing caches. The default is a thread
safe in-memory dictionary.
é    )ÚLockc                   @   s.   e Zd Zdd„ Zd
dd„Zdd„ Zdd	„ ZdS )Ú	BaseCachec                 C   s
   t ƒ ‚d S ©N©ÚNotImplementedError©ÚselfÚkey© r
   úW/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/pip/_vendor/cachecontrol/cache.pyÚget   s    zBaseCache.getNc                 C   s
   t ƒ ‚d S r   r   ©r   r	   ÚvalueÚexpiresr
   r
   r   Úset   s    zBaseCache.setc                 C   s
   t ƒ ‚d S r   r   r   r
   r
   r   Údelete   s    zBaseCache.deletec                 C   s   d S r   r
   )r   r
   r
   r   Úclose   s    zBaseCache.close)N)Ú__name__Ú
__module__Ú__qualname__r   r   r   r   r
   r
   r
   r   r      s   
r   c                   @   s0   e Zd Zd
dd„Zdd„ Zddd„Zdd	„ ZdS )Ú	DictCacheNc                 C   s   t ƒ | _|pi | _d S r   )r   ÚlockÚdata)r   Ú	init_dictr
   r
   r   Ú__init__   s    zDictCache.__init__c                 C   s   | j  |d ¡S r   )r   r   r   r
   r
   r   r   !   s    zDictCache.getc              	   C   s&   | j � | j ||i¡ W 5 Q R X d S r   )r   r   Úupdater   r
   r
   r   r   $   s    zDictCache.setc              	   C   s,   | j � || jkr| j |¡ W 5 Q R X d S r   )r   r   Úpopr   r
   r
   r   r   (   s    
zDictCache.delete)N)N)r   r   r   r   r   r   r   r
   r
   r
   r   r      s   

r   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚSeparateBodyBaseCacheag  
    In this variant, the body is not stored mixed in with the metadata, but is
    passed in (as a bytes-like object) in a separate call to ``set_body()``.

    That is, the expected interaction pattern is::

        cache.set(key, serialized_metadata)
        cache.set_body(key)

    Similarly, the body should be loaded separately via ``get_body()``.
    c                 C   s
   t ƒ ‚d S r   r   )r   r	   Úbodyr
   r
   r   Úset_body:   s    zSeparateBodyBaseCache.set_bodyc                 C   s
   t ƒ ‚dS )z6
        Return the body as file-like object.
        Nr   r   r
   r
   r   Úget_body=   s    zSeparateBodyBaseCache.get_bodyN)r   r   r   Ú__doc__r   r    r
   r
   r
   r   r   .   s   r   N)r!   Ú	threadingr   Úobjectr   r   r   r
   r
   r
   r   Ú<module>   s   