denonavr 1.1.2__py3-none-any.whl → 1.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
denonavr/decorators.py CHANGED
@@ -9,7 +9,6 @@ This module implements the REST API to Denon AVR receivers.
9
9
 
10
10
  import inspect
11
11
  import logging
12
- import time
13
12
  from functools import wraps
14
13
  from typing import Callable, TypeVar
15
14
 
@@ -64,7 +63,7 @@ def cache_result(func: Callable[..., AnyT]) -> Callable[..., AnyT]:
64
63
  """
65
64
  Decorate a function to cache its results with an lru_cache of maxsize 32.
66
65
 
67
- This decorator also sets an "cache_id" keyword argument if it is not set yet.
66
+ The cache is only used if the "cache_id" keyword argument is set.
68
67
  """
69
68
  if inspect.signature(func).parameters.get("cache_id") is None:
70
69
  raise AttributeError(
@@ -77,7 +76,7 @@ def cache_result(func: Callable[..., AnyT]) -> Callable[..., AnyT]:
77
76
  @wraps(func)
78
77
  async def wrapper(*args, **kwargs):
79
78
  if kwargs.get("cache_id") is None:
80
- kwargs["cache_id"] = time.time()
79
+ return await func(*args, **kwargs)
81
80
 
82
81
  return await cached_func(*args, **kwargs)
83
82