L iddlZddlmZmZddlmZmZedZedZedZ e Z deee efefdeee efeffd Z y) N)CallableTypeVar) Concatenate ParamSpec_P_T_Cfreturnc djztjdtdtj dtj dtffd }|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_selfargskwargsr c|rJt|dx}si}t|||j|t}|tur|S|g|i|}|||<|S)N)getattrsetattrget_cache_sentinel)rrrcache cached_valuevalue cache_namer s \/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/torch/utils/_functools.pywrapzcache_method..wrapspz z4888E D*e ,yy7  . $(((d  )__name__ functoolswrapsr rrrr)r rrs` @r cache_methodr sY"AJJ.J__Q 2 bgg  r   Kr) rtypingrrtyping_extensionsrrrrr objectrr rrr%so$4t_ T] T]( BF#R'( k"b&!2%&r