a
    |=icM  ã                   @   s:   d Z dZG dd„ deƒZefZdd„ Zdd„ Zdd	„ Zd
S )z'Key functions for memoizing decorators.)ÚhashkeyÚ	methodkeyÚtypedkeyc                   @   sF   e Zd ZdZdZejfdd„Zejfdd„Zejfdd„Zd	d
„ Z	dS )Ú_HashedTuplezðA tuple that ensures that hash() will be called no more than once
    per element, since cache decorators will hash the key multiple
    times on a cache miss.  See also _HashedSeq in the standard
    library functools implementation.

    Nc                 C   s    | j }|d u r|| ƒ | _ }|S ©N)Ú_HashedTuple__hashvalue)ÚselfÚhashÚ	hashvalue© r
   ú`/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/cachetools/keys.pyÚ__hash__   s    z_HashedTuple.__hash__c                 C   s   t || |ƒƒS r   ©r   ©r   ÚotherÚaddr
   r
   r   Ú__add__   s    z_HashedTuple.__add__c                 C   s   t ||| ƒƒS r   r   r   r
   r
   r   Ú__radd__   s    z_HashedTuple.__radd__c                 C   s   i S r   r
   )r   r
   r
   r   Ú__getstate__   s    z_HashedTuple.__getstate__)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Útupler   r   r   r   r
   r
   r
   r   r      s   r   c                  O   s*   |rt | tt| ¡ ƒtƒ ƒS t | ƒS dS )z8Return a cache key for the specified hashable arguments.N)r   ÚsumÚsortedÚitemsÚ_kwmark)ÚargsÚkwargsr
   r
   r   r   %   s    r   c                 O   s   t |i |¤ŽS )z/Return a cache key for use with cached methods.)r   )r   r   r   r
   r
   r   r   .   s    r   c                  O   sF   t | i |¤Ž}|tdd„ | D ƒƒ7 }|tdd„ t| ¡ ƒD ƒƒ7 }|S )z>Return a typed cache key for the specified hashable arguments.c                 s   s   | ]}t |ƒV  qd S r   ©Útype)Ú.0Úvr
   r
   r   Ú	<genexpr>7   ó    ztypedkey.<locals>.<genexpr>c                 s   s   | ]\}}t |ƒV  qd S r   r   )r!   Ú_r"   r
   r
   r   r#   8   r$   )r   r   r   r   )r   r   Úkeyr
   r
   r   r   3   s    r   N)r   Ú__all__r   r   r   r   r   r   r
   r
   r
   r   Ú<module>   s   	