o
    tyi                     @   sB   d Z dZG dd deZefZdd Zdd Zdd	 Zd
d ZdS )z'Key functions for memoizing decorators.)hashkey	methodkeytypedkeytypedmethodkeyc                   @   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   R/home/ubuntu/maya3_transcribe/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   _kwmarkr   sorteditems)argskwargsr   r   r   r   %   s   r   c                 O      t |i |S )z/Return a cache key for use with cached methods.)r   r   r   r   r   r   r   r   .      r   c                  O   s^   |rt t| }t| t | }|t dd |D 7 }nt| }|t dd | 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>9   s    ztypedkey.<locals>.<genexpr>c                 s   s    | ]}t |V  qd S r   r#   )r%   r'   r   r   r   r(   <   s    )r   r   r   r   r   )r   r   sorted_kwargskeyr   r   r   r   3   s   r   c                 O   r    )z5Return a typed cache key for use with cached methods.)r   r!   r   r   r   r   @   r"   r   N)	r   __all__r   r   r   r   r   r   r   r   r   r   r   <module>   s    	