/usr/lib64/python3.12/importlib/metadata/__pycache__
NameSizeModeActions
_adapters.cpython-312.opt-1.pyc38400644editdlrm
_adapters.cpython-312.opt-2.pyc35990644editdlrm
_adapters.cpython-312.pyc38400644editdlrm
_collections.cpython-312.opt-1.pyc18830644editdlrm
_collections.cpython-312.opt-2.pyc15780644editdlrm
_collections.cpython-312.pyc18830644editdlrm
_functools.cpython-312.opt-1.pyc34450644editdlrm
_functools.cpython-312.opt-2.pyc14120644editdlrm
_functools.cpython-312.pyc34450644editdlrm
_itertools.cpython-312.opt-1.pyc23580644editdlrm
_itertools.cpython-312.opt-2.pyc11500644editdlrm
_itertools.cpython-312.pyc23580644editdlrm
_meta.cpython-312.opt-1.pyc32830644editdlrm
_meta.cpython-312.opt-2.pyc30660644editdlrm
_meta.cpython-312.pyc32830644editdlrm
_text.cpython-312.opt-1.pyc38440644editdlrm
_text.cpython-312.opt-2.pyc26610644editdlrm
_text.cpython-312.pyc38440644editdlrm
__init__.cpython-312.opt-1.pyc484390644editdlrm
__init__.cpython-312.opt-2.pyc386860644editdlrm
__init__.cpython-312.pyc484390644editdlrm
Edit: /usr/lib64/python3.12/importlib/metadata/__pycache__/_functools.cpython-312.opt-1.pyc (3445B)
{|jO "ddlZddlZddZdZy)NcVxstjfd}d|_|S)aV Wrap lru_cache to support storing the cache data in the object instances. Abstracts the common paradigm where the method explicitly saves an underscore-prefixed protected property on first call and returns that subsequently. >>> class MyClass: ... calls = 0 ... ... @method_cache ... def method(self, value): ... self.calls += 1 ... return value >>> a = MyClass() >>> a.method(3) 3 >>> for x in range(75): ... res = a.method(x) >>> a.calls 75 Note that the apparent behavior will be exactly like that of lru_cache except that the cache is stored on each instance, so values in one instance will not flush values from another, and when an instance is deleted, so are the cached values for that instance. >>> b = MyClass() >>> for x in range(35): ... res = b.method(x) >>> b.calls 35 >>> a.method(0) 0 >>> a.calls 75 Note that if method had been decorated with ``functools.lru_cache()``, a.calls would have been 76 (due to the cached value of 0 having been flushed by the 'b' instance). Clear the cache with ``.cache_clear()`` >>> a.method.cache_clear() Same for a method that hasn't yet been called. >>> c = MyClass() >>> c.method.cache_clear() Another cache wrapper may be supplied: >>> cache = functools.lru_cache(maxsize=2) >>> MyClass.method2 = method_cache(lambda self: 3, cache_wrapper=cache) >>> a = MyClass() >>> a.method2() 3 Caution - do not subsequently wrap the method with another decorator, such as ``@property``, which changes the semantics of the function. See also http://code.activestate.com/recipes/577452-a-memoize-decorator-for-instance-methods/ for another implementation and additional justification. c~tj|}|}t|j|||i|SN)types MethodTypesetattr__name__)selfargskwargs bound_method cached_method cache_wrappermethods 6/usr/lib64/python3.12/importlib/metadata/_functools.pywrapperzmethod_cache..wrapperKs?''5 %l3 foo}5d-f--cyrrrrzmethod_cache..Ss$r) functools lru_cache cache_clear)rrrs`` r method_cachers-F":Y%8%8%:M.'G NrcBtjfd}|S)z Wrap func so it's not called if its first param is None >>> print_text = pass_none(print) >>> print_text('text') text >>> print_text(None) c"| |g|i|Syrr)paramr r funcs rrzpass_none..wrappercs#  /// / r)rwraps)rrs` r pass_noner Ys'__T00 Nrr)rrrr rrrr!s Ofr