Add TYPE_CHECKING checks
MODIFY
plextraktsync/trakt/ScrobblerProxy.py
plextraktsync/trakt/ScrobblerProxy.py
from __future__ import annotations
-from trakt.sync import Scrobbler
+from typing import TYPE_CHECKING
from plextraktsync.factory import logging
+if TYPE_CHECKING:
+ from trakt.sync import Scrobbler
+
class ScrobblerProxy:
"""

MODIFY
plextraktsync/trakt/TraktApi.py
plextraktsync/trakt/TraktApi.py
from __future__ import annotations
-from typing import List, Optional, Union
+from typing import TYPE_CHECKING
import trakt
import trakt.movies
import trakt.users
from deprecated import deprecated
from trakt.errors import ForbiddenException, OAuthException
-from trakt.movies import Movie
-from trakt.tv import TVEpisode, TVSeason, TVShow
from plextraktsync import pytrakt_extensions
from plextraktsync.decorators.cached_property import cached_property
from plextraktsync.decorators.time_limit import time_limit
from plextraktsync.factory import factory, logger
from plextraktsync.path import pytrakt_file
-from plextraktsync.plex.PlexGuid import PlexGuid
-from plextraktsync.plex_api import PlexLibraryItem
from plextraktsync.trakt.ScrobblerProxy import ScrobblerProxy
-from plextraktsync.trakt.TraktBatch import TraktBatch
from plextraktsync.trakt.TraktLookup import TraktLookup
from plextraktsync.trakt.TraktRatingCollection import TraktRatingCollection
+if TYPE_CHECKING:
+ from typing import List, Optional, Union
+
+ from trakt.movies import Movie
+ from trakt.tv import TVEpisode, TVSeason, TVShow
+
+ from plextraktsync.plex.PlexGuid import PlexGuid
+ from plextraktsync.plex_api import PlexLibraryItem
+ from plextraktsync.trakt.TraktBatch import TraktBatch
+
class TraktApi:
"""

MODIFY
plextraktsync/trakt/TraktBatch.py
plextraktsync/trakt/TraktBatch.py
from __future__ import annotations
from collections import defaultdict
+from typing import TYPE_CHECKING
import trakt
import trakt.movies
from plextraktsync.decorators.retry import retry
from plextraktsync.decorators.time_limit import time_limit
from plextraktsync.factory import logger
+
+if TYPE_CHECKING:
from plextraktsync.trakt.TraktApi import TraktApi
from plextraktsync.util.Cleanup import Cleanup

MODIFY
plextraktsync/trakt/TraktItem.py
plextraktsync/trakt/TraktItem.py
from __future__ import annotations
-from typing import Union
+from typing import TYPE_CHECKING
from trakt.movies import Movie
from trakt.tv import TVEpisode, TVSeason, TVShow
from plextraktsync.decorators.cached_property import cached_property
+
+if TYPE_CHECKING:
+ from typing import Union
+
from plextraktsync.trakt.TraktApi import TraktApi

MODIFY
plextraktsync/trakt/TraktLookup.py
plextraktsync/trakt/TraktLookup.py
from __future__ import annotations
-from typing import Optional
-
-from trakt.tv import TVEpisode, TVShow
+from typing import TYPE_CHECKING
from plextraktsync.decorators.cached_property import cached_property
from plextraktsync.decorators.nocache import nocache
from plextraktsync.decorators.retry import retry
from plextraktsync.factory import logger
-from plextraktsync.plex.PlexGuid import PlexGuid
EPISODES_ORDERING_WARNING = "episodes ordering is different in Plex and Trakt. " \
"Check your Plex media source, TMDB is recommended."
+if TYPE_CHECKING:
+ from typing import Optional
+
+ from trakt.tv import TVEpisode, TVShow
+
+ from plextraktsync.plex.PlexGuid import PlexGuid
+
class TraktLookup:
"""
Trakt lookup table to find all Trakt episodes of a TVShow
"""
+
def __init__(self, tm: TVShow):
self.provider_table = {}
self.tm = tm

MODIFY
plextraktsync/trakt/TraktRatingCollection.py
plextraktsync/trakt/TraktRatingCollection.py
from __future__ import annotations
+from typing import TYPE_CHECKING
+
from plextraktsync.decorators.flatten import flatten_dict
+
+if TYPE_CHECKING:
from plextraktsync.trakt.TraktApi import TraktApi

Add TYPE_CHECKING checks