
    .i                     @    d Z dZ G d de      ZefZd Zd Zd Zd Zy)	z'Key functions for memoizing decorators.)hashkey	methodkeytypedkeytypedmethodkeyc                   t    e Zd ZdZdZej                  fdZej                  fdZej                  fdZd Z	y)_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                 @    | j                   }| ||       x| _         }|S N)_HashedTuple__hashvalue)selfhash	hashvalues      Y/home/obispo/Crisostomo_bridge/mision_env/lib/python3.12/site-packages/cachetools/keys.py__hash__z_HashedTuple.__hash__   s*    $$	+/:5Dy    c                 &    t         || |            S r	   r   r   otheradds      r   __add__z_HashedTuple.__add__   s    Ce,--r   c                 &    t         |||             S r	   r   r   s      r   __radd__z_HashedTuple.__radd__   s    Ct,--r   c                     i S r	    )r   s    r   __getstate__z_HashedTuple.__getstate__   s    	r   )
__name__
__module____qualname____doc__r
   tupler   r   r   r   r   r   r   r   r      s;     K!NN  "' . #(-- .r   r   c            	          |r5t        | t        z   t        t        |j	                                     z         S t        |       S )z8Return a cache key for the specified hashable arguments.)r   _kwmarkr    sorteditems)argskwargss     r   r   r   %   s6     D7NU6&,,.3I-JJKKD!!r   c                     t        |i |S )z/Return a cache key for use with cached methods.)r   r   r%   r&   s      r   r   r   .   s    D#F##r   c                      |rMt        t        |j                                     }t        | t        z   |z         }|t        d |D              z  }nt        |       }|t        d | D              z  }|S )z>Return a typed cache key for the specified hashable arguments.c              3   8   K   | ]  \  }}t        |        y wr	   type).0_vs      r   	<genexpr>ztypedkey.<locals>.<genexpr>9   s     7AT!W7s   c              3   2   K   | ]  }t        |        y wr	   r+   )r-   r/   s     r   r0   ztypedkey.<locals>.<genexpr><   s     'Qa's   )r    r#   r$   r   r"   )r%   r&   sorted_kwargskeys       r   r   r   3   sh     fV\\^454'>M9:u77774 5'$'''CJr   c                     t        |i |S )z5Return a typed cache key for use with cached methods.)r   r(   s      r   r   r   @   s    T$V$$r   N)	r   __all__r    r   r"   r   r   r   r   r   r   r   <module>r6      s6    -
@5 8 /"$

%r   