o
    tBh                     @   s2   d Z dZG dd deZefZdd Zdd ZdS )	z'Key functions for memoizing decorators.)hashkey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 )_HashedTuplezA 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	   f/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/cachetools/keys.py__hash__   s   z_HashedTuple.__hash__c                 C   s   t || |S r   r   r   otheraddr	   r	   r
   __add__      z_HashedTuple.__add__c                 C   s   t ||| S r   r   r   r	   r	   r
   __radd__   r   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 )z8Return a cache key for the specified hashable arguments.)r   sumsorteditems_kwmark)argskwargsr	   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>2   s    ztypedkey.<locals>.<genexpr>c                 s   s    | ]	\}}t |V  qd S r   r   )r!   _r"   r	   r	   r
   r#   3   s    )r   r   r   r   )r   r   keyr	   r	   r
   r   .   s   r   N)r   __all__r   r   r   r   r   r	   r	   r	   r
   <module>   s    	