allow decorator_args for timed_alru_cache

This commit is contained in:
Jörn-Michael Miehe 2022-09-06 07:55:44 +00:00
parent f99e45c7bb
commit a73dc51e25

View file

@ -36,14 +36,14 @@ def get_ttl_hash(seconds: int = 20) -> int:
return round(time() / seconds) return round(time() / seconds)
def timed_alru_cache(**decorator_kwargs): def timed_alru_cache(*decorator_args, **decorator_kwargs):
""" """
Decorator which adds an (unused) param `ttl_hash` Decorator which adds an (unused) param `ttl_hash`
and the `@alru_cache` annotation to a function. and the `alru_cache` annotation to a function.
""" """
def decorate(f): def decorate(f):
@alru_cache(**decorator_kwargs) @alru_cache(*decorator_args, **decorator_kwargs)
@wraps(f) @wraps(f)
async def wrapper(ttl_hash: int, *args, **kwargs): async def wrapper(ttl_hash: int, *args, **kwargs):
del ttl_hash del ttl_hash