Rewrite nocache as function to support decorators on class method arguments
MODIFY
plex_trakt_sync/decorators/__init__.py
plex_trakt_sync/decorators/__init__.py
from .measure_time import measure_time
from .memoize import memoize
-from .nocache import CacheDisabledDecorator as nocache
+from .nocache import nocache
from .rate_limit import rate_limit

MODIFY
plex_trakt_sync/decorators/nocache.py
plex_trakt_sync/decorators/nocache.py
-import requests_cache
+from functools import wraps
+import requests_cache
-class CacheDisabledDecorator:
- def __init__(self, fn):
- self.fn = fn
- def __call__(self, *args):
+def nocache(method):
+ @wraps(method)
+ def inner(self, *args, **kwargs):
with requests_cache.disabled():
- return self.fn(*args)
+ return method(self, *args, **kwargs)
+
+ return inner

Rewrite nocache as function to support decorators on class method arguments