Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move decorators to own namespace #175

Merged
merged 2 commits into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions plex_trakt_sync/decorators/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .measure_time import measure_time
from .memoize import memoize
from .nocache import CacheDisabledDecorator as nocache
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
import logging
from contextlib import contextmanager
from time import time
from plex_trakt_sync.nocache import CacheDisabledDecorator as nocache

try:
from functools import cache as memoize
except ImportError:
# For py<3.9
# https://docs.python.org/3.9/library/functools.html
from functools import lru_cache as memoize


@contextmanager
Expand Down
6 changes: 6 additions & 0 deletions plex_trakt_sync/decorators/memoize.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
try:
from functools import cache as memoize
except ImportError:
# For py<3.9
# https://docs.python.org/3.9/library/functools.html
from functools import lru_cache as memoize
File renamed without changes.
2 changes: 1 addition & 1 deletion plex_trakt_sync/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def process_movie_section(section: PlexLibrarySection, watched_set, ratings_dict
movie.title, movie.year))
except trakt.errors.NotFoundException:
logging.error(
"Movie [{} ({})]: GUID {} not found on trakt".format(movie.title, movie.year, guid))
"Movie [{} ({})]: GUID {} not found on trakt".format(movie.title, movie.year, it.guid))
except trakt.errors.RateLimitException as e:
delay = int(e.response.headers.get("Retry-After", 1))
logging.warning(
Expand Down