mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 23:42:37 -07:00
Update backports.functools-lru-cache-1.6.4
This commit is contained in:
parent
0770a301c7
commit
9ba5656ad8
1 changed files with 4 additions and 4 deletions
|
@ -4,7 +4,7 @@ import functools
|
||||||
from collections import namedtuple
|
from collections import namedtuple
|
||||||
from threading import RLock
|
from threading import RLock
|
||||||
|
|
||||||
_CacheInfo = namedtuple("CacheInfo", ["hits", "misses", "maxsize", "currsize"])
|
_CacheInfo = namedtuple("_CacheInfo", ["hits", "misses", "maxsize", "currsize"])
|
||||||
|
|
||||||
|
|
||||||
@functools.wraps(functools.update_wrapper)
|
@functools.wraps(functools.update_wrapper)
|
||||||
|
@ -63,7 +63,7 @@ def _make_key(
|
||||||
return _HashedSeq(key)
|
return _HashedSeq(key)
|
||||||
|
|
||||||
|
|
||||||
def lru_cache(maxsize=100, typed=False):
|
def lru_cache(maxsize=100, typed=False): # noqa: C901
|
||||||
"""Least-recently-used cache decorator.
|
"""Least-recently-used cache decorator.
|
||||||
|
|
||||||
If *maxsize* is set to None, the LRU features are disabled and the cache
|
If *maxsize* is set to None, the LRU features are disabled and the cache
|
||||||
|
@ -136,7 +136,7 @@ def lru_cache(maxsize=100, typed=False):
|
||||||
if link is not None:
|
if link is not None:
|
||||||
# record recent use of the key by moving it
|
# record recent use of the key by moving it
|
||||||
# to the front of the list
|
# to the front of the list
|
||||||
root, = nonlocal_root
|
(root,) = nonlocal_root
|
||||||
link_prev, link_next, key, result = link
|
link_prev, link_next, key, result = link
|
||||||
link_prev[NEXT] = link_next
|
link_prev[NEXT] = link_next
|
||||||
link_next[PREV] = link_prev
|
link_next[PREV] = link_prev
|
||||||
|
@ -148,7 +148,7 @@ def lru_cache(maxsize=100, typed=False):
|
||||||
return result
|
return result
|
||||||
result = user_function(*args, **kwds)
|
result = user_function(*args, **kwds)
|
||||||
with lock:
|
with lock:
|
||||||
root, = nonlocal_root
|
(root,) = nonlocal_root
|
||||||
if key in cache:
|
if key in cache:
|
||||||
# getting here means that this same key was added to the
|
# getting here means that this same key was added to the
|
||||||
# cache while the lock was released. since the link
|
# cache while the lock was released. since the link
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue