/opt/imunify360/venv/lib/python3.11/site-packages/diskcache/__pycache__
NameSizeModeActions
cli.cpython-311.pyc2690644editdlrm
core.cpython-311.pyc954450644editdlrm
djangocache.cpython-311.pyc197340644editdlrm
fanout.cpython-311.pyc318780644editdlrm
persistent.cpython-311.pyc460320644editdlrm
recipes.cpython-311.pyc220610644editdlrm
__init__.cpython-311.pyc16760644editdlrm
Edit: /opt/imunify360/venv/lib/python3.11/site-packages/diskcache/__pycache__/recipes.cpython-311.pyc (22061B)
§ 7Š(®CÂà¨ãóî—dZddlZddlZddlZddlZddlZddlZddlmZm Z m Z Gd„d¦«Z Gd„d¦«Z Gd „d ¦«Z Gd „d ¦«Zdddejejfd „Zdd„Z dd„ZdS)zDisk Cache Recipes éNé)ÚENOVALÚ args_to_keyÚ full_namecó,—eZdZdZdd„Zd„Zd„Zd„ZdS)ÚAverageraLRecipe for calculating a running average. Sometimes known as "online statistics," the running average maintains the total and count. The average can then be calculated at any time. Assumes the key will not be evicted. Set the eviction policy to 'none' on the cache to guarantee the key is not evicted. >>> import diskcache >>> cache = diskcache.FanoutCache() >>> ave = Averager(cache, 'latency') >>> ave.add(0.080) >>> ave.add(0.120) >>> ave.get() 0.1 >>> ave.add(0.160) >>> ave.pop() 0.12 >>> print(ave.get()) None Ncó>—||_||_||_||_dS©N©Ú_cacheÚ_keyÚ_expireÚ_tag©ÚselfÚcacheÚkeyÚexpireÚtags úq/builddir/build/BUILD/imunify360-venv-2.6.3/opt/imunify360/venv/lib/python3.11/site-packages/diskcache/recipes.pyÚ__init__zAverager.__init__&ó"€ØˆŒ ؈Œ ؈Œ ؈Œ ˆ ˆ ócó(—|j d¬¦«5|j |jd¬¦«\}}||z }|dz }|j |j||f|j|j¬¦«ddd¦«dS#1swxYwYdS)zAdd `value` to average.T©Úretry©gr©Údefaultr©rrN)r ÚtransactÚgetr Úsetrr)rÚvalueÚtotalÚcounts rÚaddz Averager.add,sá€à Œ[× !Ò !¨Ð !Ñ -Ô -ð ð Øœ;Ÿ?š?¨4¬9¸h˜?ÑGÔG‰LˆE�5Ø �U‰NˆEØ �Q‰JˆEØ ŒK�OŠOØ” ؘ�Ø”|Ø”Ið ñ ô ð ð ð ð ñ ô ð ð ð ð ð ð ð øøøð ð ð ð ð ð sœABÂB ÂB cóf—|j |jdd¬¦«\}}|dkrdn||z S)z:Get current average or return `None` if count equals zero.rT©rrrN)r r"r ©rr%r&s rr"z Averager.get9ó7€à”{—’ t¤y¸(È$�ÑOÔO‰ ˆˆuØ ’z�zˆtˆt u¨u¡}Ð4rcóf—|j |jdd¬¦«\}}|dkrdn||z S)z&Return current average and delete key.rTr)rN)r Úpopr r*s rr-z Averager.pop>r+r©NN)Ú__name__Ú __module__Ú __qualname__Ú__doc__rr'r"r-©rrrrs_€€€€€ððð.ðððð ð ð ð5ð5ð5ð 5ð5ð5ð5ð5rrcó8—eZdZdZd d„Zd„Zd„Zd„Zd„Zd„Z dS) ÚLockanRecipe for cross-process and cross-thread lock. Assumes the key will not be evicted. Set the eviction policy to 'none' on the cache to guarantee the key is not evicted. >>> import diskcache >>> cache = diskcache.Cache() >>> lock = Lock(cache, 'report-123') >>> lock.acquire() >>> lock.release() >>> with lock: ... pass Ncó>—||_||_||_||_dSr r rs rrz Lock.__init__Trrcó’— |j |jd|j|jd¬¦«}|rdSt jd¦«ŒG)z'Acquire lock using spin-lock algorithm.TN©rrrçü©ñÒMbP?)r r'r rrÚtimeÚsleep)rÚaddeds rÚacquirez Lock.acquireZsZ€ð Ø”K—O’OØ” ØØ”|Ø”IØð $ñôˆEðð Ø�Ý ŒJ�uÑ Ô Ð ð rcóH—|j |jd¬¦«dS)zRelease lock by deleting key.TrN)r Údeleter ©rs rÚreleasez Lock.releasehs%€à Œ ×Ò˜4œ9¨DÐÑ1Ô1Ð1Ð1Ð1rcó—|j|jvS)z$Return true if the lock is acquired.)r r r@s rÚlockedz Lock.lockedls€àŒy˜DœKÐ'Ð'rcó.—| ¦«dSr ©r=r@s rÚ __enter__zLock.__enter__pó€Ø � Š ‰Œˆˆˆrcó.—| ¦«dSr ©rA©rÚexc_infos rÚ__exit__z Lock.__exit__srGrr.) r/r0r1r2rr=rArCrFrLr3rrr5r5Ds}€€€€€ð ð ððððð ð ð ð2ð2ð2ð(ð(ð(ððððððððrr5có2—eZdZdZdd„Zd„Zd„Zd„Zd„ZdS) ÚRLocka)Recipe for cross-process and cross-thread re-entrant lock. Assumes the key will not be evicted. Set the eviction policy to 'none' on the cache to guarantee the key is not evicted. >>> import diskcache >>> cache = diskcache.Cache() >>> rlock = RLock(cache, 'user-123') >>> rlock.acquire() >>> rlock.acquire() >>> rlock.release() >>> with rlock: ... pass >>> rlock.release() >>> rlock.release() Traceback (most recent call last): ... AssertionError: cannot release un-acquired lock Ncó>—||_||_||_||_dSr r rs rrzRLock.__init__�rrcóî—tj¦«}tj¦«}d ||¦«} |j d¬¦«5|j |jd¬¦«\}}||ks|dkr@|j  |j||dzf|j |j ¬¦« d d d ¦«d S d d d ¦«n #1swxYwYtj d ¦«Œ¹) z=Acquire lock by incrementing count using spin-lock algorithm.ú{}-{}Tr©Nrrrrr Nr9)ÚosÚgetpidÚ threadingÚ get_identÚformatr r!r"r r#rrr:r;)rÚpidÚtidÚpid_tidr$r&s rr=z RLock.acquire“sP€åŒi‰kŒkˆÝÔ!Ñ#Ô#ˆØ—.’.  cÑ*Ô*ˆð Ø”×%Ò%¨DÐ%Ñ1Ô1ð ð Ø#œ{Ÿš¨t¬yÀ)˜ÑLÔL‘ ��uؘeÒ#Ð# u°¢z zØ”K—O’OØœ Ø  %¨!¡)Ð,Ø#œ|Ø œIð $ñôðð ð ð ð ñ ô ð ð ð à'1ð ð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð õ ŒJ�uÑ Ô Ð ð sÁA$CÃCÃCcó—tj¦«}tj¦«}d ||¦«}|j d¬¦«5|j |jd¬¦«\}}||ko|dk}|s Jd¦«‚|j  |j||dz f|j |j ¬ ¦«d d d ¦«d S#1swxYwYd S) z#Release lock by decrementing count.rQTrrRrrzcannot release un-acquired lockrr N) rSrTrUrVrWr r!r"r r#rr)rrXrYrZr$r&Úis_owneds rrAz RLock.release¦s'€åŒi‰kŒkˆÝÔ!Ñ#Ô#ˆØ—.’.  cÑ*Ô*ˆà Œ[× !Ò !¨Ð !Ñ -Ô -ð ð Øœ;Ÿ?š?¨4¬9¸i˜?ÑHÔH‰LˆE�5Ø %Ò'Ð5¨E°AªIˆHØÐ >Ð >Ð>Ñ >Ô >�8Ø ŒK�OŠOØ” ؘ ™ Ð"Ø”|Ø”Ið ñ ô ð ð ð ð ñ ô ð ð ð ð ð ð ð øøøð ð ð ð ð ð sÁA/CÃCÃCcó.—| ¦«dSr rEr@s rrFzRLock.__enter__·rGrcó.—| ¦«dSr rIrJs rrLzRLock.__exit__ºrGrr.© r/r0r1r2rr=rArFrLr3rrrNrNwsn€€€€€ððð*ðððð ððð&ððð"ðððððððrrNcó2—eZdZdZd d„Zd„Zd„Zd„Zd„ZdS) ÚBoundedSemaphorea`Recipe for cross-process and cross-thread bounded semaphore. Assumes the key will not be evicted. Set the eviction policy to 'none' on the cache to guarantee the key is not evicted. >>> import diskcache >>> cache = diskcache.Cache() >>> semaphore = BoundedSemaphore(cache, 'max-cons', value=2) >>> semaphore.acquire() >>> semaphore.acquire() >>> semaphore.release() >>> with semaphore: ... pass >>> semaphore.release() >>> semaphore.release() Traceback (most recent call last): ... AssertionError: cannot release un-acquired semaphore rNcóL—||_||_||_||_||_dSr )r r Ú_valuerr)rrrr$rrs rrzBoundedSemaphore.__init__Ôs)€ØˆŒ ؈Œ ؈Œ ؈Œ ؈Œ ˆ ˆ rcój— |j d¬¦«5|j |j|j¬¦«}|dkr>|j |j|dz |j|j¬¦« ddd¦«dS ddd¦«n #1swxYwYtj d¦«Œ³) zBAcquire semaphore by decrementing value using spin-lock algorithm.Trrrrr Nr9) r r!r"r rcr#rrr:r;©rr$s rr=zBoundedSemaphore.acquireÛs€ð Ø”×%Ò%¨DÐ%Ñ1Ô1ð ð Øœ Ÿš¨¬ ¸4¼;˜ÑGÔG�ؘ1’9�9Ø”K—O’OØœ Ø ™ Ø#œ|Ø œIð $ñôðð ð ð ð ñ ô ð ð ð àð ð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð õ ŒJ�uÑ Ô Ð ð s�ABÂBÂBcóH—|j d¬¦«5|j |j|j¬¦«}|j|ks Jd¦«‚|dz }|j |j||j|j¬¦«ddd¦«dS#1swxYwYdS)z(Release semaphore by incrementing value.Trrz$cannot release un-acquired semaphorerr N)r r!r"r rcr#rrres rrAzBoundedSemaphore.releaseêsî€à Œ[× !Ò !¨Ð !Ñ -Ô -ð ð Ø”K—O’O D¤I°t´{�OÑCÔCˆEØ”; Ò&Ð&Ð&Ð(NÑ&Ô&Ð&Ø �Q‰JˆEØ ŒK�OŠOØ” ØØ”|Ø”Ið ñ ô ð ð ð ð ñ ô ð ð ð ð ð ð ð øøøð ð ð ð ð ð sœA.BÂBÂBcó.—| ¦«dSr rEr@s rrFzBoundedSemaphore.__enter__÷rGrcó.—| ¦«dSr rIrJs rrLzBoundedSemaphore.__exit__úrGr)rNNr_r3rrrara¾sn€€€€€ððð*ðððð ð ð ð ð ð ððððððððrracó.‡‡‡‡‡‡‡‡—ˆˆˆˆˆˆˆˆfd„}|S)a(Decorator to throttle calls to function. Assumes keys will not be evicted. Set the eviction policy to 'none' on the cache to guarantee the keys are not evicted. >>> import diskcache, time >>> cache = diskcache.Cache() >>> count = 0 >>> @throttle(cache, 2, 1) # 2 calls per 1 second ... def increment(): ... global count ... count += 1 >>> start = time.time() >>> while (time.time() - start) <= 2: ... increment() >>> count in (6, 7) # 6 or 7 calls depending on CPU load True c ó𕇇‡—‰t‰ ¦«z Љ€t‰¦«n‰Š‰ ¦«}‰ ‰|‰f‰‰ d¬¦«tj‰¦«ˆˆˆˆˆˆˆ ˆ fd„¦«}|S)NTr8c󌕗 ‰ d¬¦«5‰ ‰ ¦«\}}‰ ¦«}|||z ‰ zz }d}|‰kr‰ ‰ |‰dz f‰¦«n+|dkr‰ ‰ ||dz f‰¦«nd|z ‰ z }ddd¦«n #1swxYwY|r ‰ |¦«nnŒ»‰ |i|¤ŽS)NTrrr)r!r"r#)ÚargsÚkwargsÚlastÚtallyÚnowÚdelayrr&rÚfuncrÚrateÚ sleep_funcÚ time_funcs €€€€€€€€rÚwrapperz,throttle..decorator..wrapper"sGø€ð Ø—^’^¨$�^Ñ/Ô/ð 3ð 3Ø"'§)¢)¨C¡.¤.‘K�D˜%Ø#˜)™+œ+�Cؘc D™j¨DÑ0Ñ0�EØ�Eà˜u’}�}ØŸ š  #¨¨U°Q©YÐ'7¸Ñ@Ô@Ð@Ð@Ø !š˜ØŸ š  #¨¨U°Q©YÐ'7¸Ñ@Ô@Ð@Ð@à!" U¡¨dÑ 2˜ð 3ð 3ð 3ñ 3ô 3ð 3ð 3ð 3ð 3ð 3ð 3øøøð 3ð 3ð 3ð 3ððØ�J˜uÑ%Ô%Ð%Ð%àð# ð&�4˜Ð( Ð(Ð(Ð (s™A>B#Â#B'Â*B')Úfloatrr#Ú functoolsÚwraps) rrrprvrrsrr&rÚnameÚsecondsrtrrus ` @@€€€€€€€€rÚ decoratorzthrottle..decorators¬øøøø€Ø•u˜W‘~”~Ñ%ˆØ!% �i˜‰oŒoˆo°4ˆØˆi‰kŒkˆØ � Š �#˜˜U�|¨F¸À4ˆ ÑHÔHÐHå Œ˜Ñ Ô ð )ð )ð )ð )ð )ð )ð )ð )ð )ð )ð )ñ Ô ð )ð,ˆrr3) rr&r{rzrrrurtr|s ```````` rÚthrottler}þsNøøøøøøøø€ð<ðððððððððððð> Ðrcó"‡‡‡‡‡—ˆˆˆˆˆfd„}|S)a°Barrier to calling decorated function. Supports different kinds of locks: Lock, RLock, BoundedSemaphore. Assumes keys will not be evicted. Set the eviction policy to 'none' on the cache to guarantee the keys are not evicted. >>> import diskcache, time >>> cache = diskcache.Cache() >>> @barrier(cache, Lock) ... def work(num): ... print('worker started') ... time.sleep(1) ... print('worker finished') >>> import multiprocessing.pool >>> pool = multiprocessing.pool.ThreadPool(2) >>> _ = pool.map(work, range(2)) worker started worker finished worker started worker finished >>> pool.terminate() có�•‡‡—‰€t‰¦«n‰}‰‰|‰‰¬¦«Štj‰¦«ˆˆfd„¦«}|S)Nr cóL•—‰5‰|i|¤Žcddd¦«S#1swxYwYdSr r3)rlrmrrÚlocks €€rrvz+barrier..decorator..wrapper\sø€àð -ð -Ø�t˜TÐ, VÐ,Ð,ð -ð -ð -ð -ñ -ô -ð -ð -ð -ð -ð -ð -øøøð -ð -ð -ð -ð -ð -s „™ )rrxry) rrrrvr�rrÚ lock_factoryrzrs ` @€€€€€rr|zbarrier..decoratorXsjøøø€Ø!% �i˜‰oŒoˆo°4ˆØˆ|˜E 3¨v¸3Ð?Ñ?Ô?ˆå Œ˜Ñ Ô ð -ð -ð -ð -ð -ñ Ô ð -ðˆrr3)rr‚rzrrr|s````` rÚbarrierrƒ>s<øøøøø€ð4 ð ð ð ð ð ð ð ð ð ÐrFr3có*‡‡‡‡‡‡‡—ˆˆˆˆˆˆˆfd„}|S)a/ Memoizing cache decorator with cache stampede protection. Cache stampedes are a type of system overload that can occur when parallel computing systems using memoization come under heavy load. This behaviour is sometimes also called dog-piling, cache miss storm, cache choking, or the thundering herd problem. The memoization decorator implements cache stampede protection through early recomputation. Early recomputation of function results will occur probabilistically before expiration in a background thread of execution. Early probabilistic recomputation is based on research by Vattani, A.; Chierichetti, F.; Lowenstein, K. (2015), Optimal Probabilistic Cache Stampede Prevention, VLDB, pp. 886-897, ISSN 2150-8097 If name is set to None (default), the callable name will be determined automatically. If typed is set to True, function arguments of different types will be cached separately. For example, f(3) and f(3.0) will be treated as distinct calls with distinct results. The original underlying function is accessible through the `__wrapped__` attribute. This is useful for introspection, for bypassing the cache, or for rewrapping the function with a different cache. >>> from diskcache import Cache >>> cache = Cache() >>> @memoize_stampede(cache, expire=1) ... def fib(number): ... if number == 0: ... return 0 ... elif number == 1: ... return 1 ... else: ... return fib(number - 1) + fib(number - 2) >>> print(fib(100)) 354224848179261915075 An additional `__cache_key__` attribute can be used to generate the cache key used for the given arguments. >>> key = fib.__cache_key__(100) >>> del cache[key] Remember to call memoize when decorating a callable. If you forget, then a TypeError will occur. :param cache: cache to store callable arguments and return values :param float expire: seconds until arguments expire :param str name: name given for callable (default None, automatic) :param bool typed: cache different types separately (default False) :param str tag: text to associate with arguments (default None) :param set ignore: positional or keyword args to ignore (default ()) :return: callable decorator c󨕇‡‡‡—‰ €t‰¦«fn‰ fŠˆfd„Štj‰¦«ˆˆˆˆ ˆˆfd„¦«Šˆˆˆ fd„}|‰_‰S)z/Decorator created by memoize call for callable.Ncón•—tj¦«}‰|i|¤Ž}tj¦«|z }||fS)z:Time execution of `func` and return result and time delta.)r:)rlrmÚstartÚresultÚdeltarrs €rÚtimerz2memoize_stampede..decorator..timer¦s<ø€å”I‘K”KˆEØ�T˜4Ð* 6Ð*Ð*ˆFÝ”I‘K”K %Ñ'ˆEؘ5�=Ð rcó0•‡‡‡ —‰j‰i‰¤ŽŠ ‰ ‰ tdd¬¦«\}}|tur²|\}}tj¦«}||z }| ‰ zt jt j¦«¦«z|kr|S‰ tfz}‰ |d|d¬¦«} | r;ˆˆˆˆ ˆˆˆfd„} tj | ¬¦«} d| _ |   ¦«|S‰‰i‰¤Ž}‰  ‰ |‰‰d¬¦«|dS) z:Wrapper for callable to cache arguments and return values.T)rÚ expire_timerN)rrcó‚•—‰5‰‰i‰¤Ž}‰ ‰|‰‰d¬¦«ddd¦«dS#1swxYwYdS)NTr8)r#)ÚpairrlrrrrmrrŠs €€€€€€€rÚ recomputezGmemoize_stampede..decorator..wrapper..recomputeÌs«ø€Ø"ððØ#( 5¨$Ð#9°&Ð#9Ð#9˜DØ!ŸIšIØ #Ø $Ø'-Ø$'Ø&*ð &ñôððððñôðððððððøøøððððððs „#4´8»8)Útargetr8r) Ú __cache_key__r"rr:ÚmathÚlogÚrandomr'rUÚThreadÚdaemonr‡r#)rlrmrŽrŒrˆr‰rpÚttlÚ thread_keyÚ thread_addedr�ÚthreadrÚbetarrrrŠrvs`` @€€€€€€rrvz4memoize_stampede..decorator..wrapper­swøøøø€ð(�'Ô'¨Ð8°Ð8Ð8ˆCØ %§ ¢ ØÝØ Øð !*ñ!ô!Ñ ˆD�+ð�6Ð!Ð!Ø $‘ �˜Ý”i‘k”k�Ø! CÑ'�à�F˜T‘M¥D¤H­V¬]©_¬_Ñ$=Ô$=Ñ=ÀÒDÐDØ!�Mð!¥F 9™_� Ø$ŸyšyØØØ Øð )ñ ô � ð ð#ð ð ð ð ð ð ð ð ð ð ð õ'Ô-°YÐ?Ñ?Ô?�FØ$(�F”MØ—L’L‘N”N�Nà� à�5˜$Ð) &Ð)Ð)ˆDØ �IŠI�c˜4¨°C¸tˆIÑ DÔ DÐ Dؘ”7ˆNrcó*•—t‰||‰‰¦«S)z,Make key for cache given function arguments.)r)rlrmÚbaseÚignoreÚtypeds €€€rr‘z:memoize_stampede..decorator..__cache_key__ásø€å˜t T¨6°5¸&ÑAÔAÐ Ar)rrxryr‘) rrr‘r�rŠrvr›rrržrzrrŸs ` @@@€€€€€€€rr|z#memoize_stampede..decorator¢s¼øøøøø€à%) \• ˜$‘”Ð!Ð!¸°wˆð !ð !ð !ð !ð !õ Œ˜Ñ Ô ð1 ð1 ð1 ð1 ð1 ð1 ð1 ð1 ð1 ñ Ô ð1 ðf Bð Bð Bð Bð Bð Bð Bð!.ˆÔ؈rr3)rrrzrŸrr›ržr|s``````` rÚmemoize_stampeder fsUøøøøøøø€ðxDðDðDðDðDðDðDðDðDðDðDðL Ðr)NNN)NFNrr3)r2rxr’rSr”rUr:Úcorerrrrr5rNrar;r}rƒr r3rrúr¢s�ððððÐÐÐØ € € € Ø € € € Ø € € € ØÐÐÐØ € € € à0Ð0Ð0Ð0Ð0Ð0Ð0Ð0Ð0Ð0ð35ð35ð35ð35ð35ñ35ô35ð35ðl0ð0ð0ð0ð0ñ0ô0ð0ðfDðDðDðDðDñDôDðDðN=ð=ð=ð=ð=ñ=ô=ð=ðH Ø Ø ØŒiØŒzð=ð=ð=ð=ð@%ð%ð%ð%ðREGðBðBðBðBðBðBr