
    [iI                         d dl Z d dlmZ d dlmZmZ d dlmZ  ed          Z ed          Z	 ed          Z
 e            Zdeee
ef         e	f         d	eee
ef         e	f         fd
ZdS )    N)Callable)ConcatenateTypeVar)	ParamSpec_P_T_Cfreturnc           	           d j         z   t          j                   dt          dt          j        dt          j        dt          f fd            }|S )a  
    Like `@functools.cache` but for methods.

    `@functools.cache` (and similarly `@functools.lru_cache`) shouldn't be used
    on methods because it caches `self`, keeping it alive
    forever. `@cache_method` ignores `self` so won't keep `self` alive (assuming
    no cycles with `self` in the parameters).

    Footgun warning: This decorator completely ignores self's properties so only
    use it when you know that self is frozen or won't change in a meaningful
    way (such as the wrapped function being pure).
    _cache_method_selfargskwargsr   c                     |rt          d          t          | d           x}si }t          | |           |                    |t                    }|t          ur|S  | g|R i |}|||<   |S )Nz.cache_method does not accept keyword arguments)AssertionErrorgetattrsetattrget_cache_sentinel)r   r   r   cachecached_valuevalue
cache_namer
   s         I/var/www/icac/venv/lib/python3.11/site-packages/torch/utils/_functools.pywrapzcache_method.<locals>.wrap    s     	S !QRRR z4888 	-ED*e,,,yy77..$((((((d    )__name__	functoolswrapsr	   r   r   r   r   )r
   r   r   s   ` @r   cache_methodr!      sq     "AJ.J_Q2 bg  r        Kr   )r   collections.abcr   typingr   r   typing_extensionsr   r   r   r	   objectr   r!    r   r   <module>r'      s        $ $ $ $ $ $ ' ' ' ' ' ' ' ' ' ' ' ' ' ' Yt__WT]]WT]] &((!BF#R'(!k"b&!2%&! ! ! ! ! !r   