Skip to content

Commit

Permalink
chore: format project
Browse files Browse the repository at this point in the history
  • Loading branch information
dylandoamaral committed Aug 27, 2024
1 parent 8a2352c commit 29d889f
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
11 changes: 7 additions & 4 deletions custom_components/trakt_tv/apis/trakt.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def __init__(
def cache(self) -> Dict[str, Any]:
return self.hass.data[DOMAIN].get("cache", {})


async def async_get_access_token(self) -> str:
"""Return a valid access token."""
if not self.oauth_session.valid_token:
Expand Down Expand Up @@ -408,7 +407,8 @@ async def fetch_stats(self):

async def fetch_anticipated(self, path: str, limit: int, ignore_collected: bool):
return await self.request(
"get", f"{path}/anticipated?limit={limit}&ignore_collected={ignore_collected}"
"get",
f"{path}/anticipated?limit={limit}&ignore_collected={ignore_collected}",
)

async def fetch_anticipated_medias(self, configured_kinds: list[TraktKind]):
Expand All @@ -430,7 +430,7 @@ async def fetch_anticipated_medias(self, configured_kinds: list[TraktKind]):
self.fetch_anticipated(
kind.value.path,
configuration.get_anticipated_max_medias(kind.value.identifier),
configuration.anticipated_exclude_collected(kind.value.identifier)
configuration.anticipated_exclude_collected(kind.value.identifier),
)
for kind in kinds
]
Expand All @@ -441,7 +441,10 @@ async def fetch_anticipated_medias(self, configured_kinds: list[TraktKind]):
for trakt_kind, raw_medias in zip(kinds, data):
if raw_medias is not None:
medias = [
trakt_kind.value.model.from_trakt(media[trakt_kind.value.identifier]) for media in raw_medias
trakt_kind.value.model.from_trakt(
media[trakt_kind.value.identifier]
)
for media in raw_medias
]
await gather(
*[media.get_more_information(language) for media in medias]
Expand Down
3 changes: 2 additions & 1 deletion custom_components/trakt_tv/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from voluptuous import ALLOW_EXTRA, PREVENT_EXTRA, In, Required, Schema

from .const import DOMAIN, LANGUAGE_CODES
from .models.kind import BASIC_KINDS, NEXT_TO_WATCH_KINDS, TraktKind, ANTICIPATED_KINDS
from .models.kind import ANTICIPATED_KINDS, BASIC_KINDS, NEXT_TO_WATCH_KINDS, TraktKind


def dictionary_to_schema(
Expand Down Expand Up @@ -88,6 +88,7 @@ def anticipated_schema() -> Dict[str, Any]:

return subschemas


def stats_schema() -> list[str]:
return [
"all",
Expand Down
8 changes: 6 additions & 2 deletions custom_components/trakt_tv/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

from .configuration import Configuration
from .const import DOMAIN
from .models.kind import BASIC_KINDS, NEXT_TO_WATCH_KINDS, TraktKind, ANTICIPATED_KINDS
from .models.kind import ANTICIPATED_KINDS, BASIC_KINDS, NEXT_TO_WATCH_KINDS, TraktKind

LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -62,7 +62,11 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
trakt_kind=trakt_kind,
source="anticipated",
prefix="Trakt Anticipated",
mdi_icon="mdi:movie" if trakt_kind == TraktKind.ANTICIPATED_MOVIE else "mdi:television",
mdi_icon=(
"mdi:movie"
if trakt_kind == TraktKind.ANTICIPATED_MOVIE
else "mdi:television"
),
)
sensors.append(sensor)

Expand Down

0 comments on commit 29d889f

Please sign in to comment.