Skip to content

Commit

Permalink
Merge pull request #171 from glensc/cleanup-imports
Browse files Browse the repository at this point in the history
Chore: Code cleanups
  • Loading branch information
moogar0880 authored Jan 12, 2022
2 parents a2abfac + 687e406 commit 982c3c5
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 23 deletions.
1 change: 0 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-
import json
import os
import sys
from copy import deepcopy

import trakt
Expand Down
1 change: 0 additions & 1 deletion tests/test_episodes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
"""trakt.tv functional tests"""
from datetime import datetime
from trakt.core import Comment
from trakt.sync import Scrobbler
from trakt.tv import TVSeason, TVEpisode
Expand Down
1 change: 0 additions & 1 deletion tests/test_search.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
"""trakt.sync functional tests"""
import pytest
from trakt.movies import Movie
from trakt.people import Person
from trakt.sync import get_search_results, search, search_by_id, SearchResult
Expand Down
4 changes: 2 additions & 2 deletions tests/test_users.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# -*- coding: utf-8 -*-
from trakt.movies import Movie
from trakt.tv import TVShow, TVEpisode, TVSeason
from trakt.users import (User, UserList, Request, follow, get_all_requests,
get_user_settings, unfollow)
from trakt.users import (User, UserList, Request, get_all_requests,
get_user_settings)
from trakt.people import Person


Expand Down
10 changes: 5 additions & 5 deletions trakt/movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def aliases(self):
they go by their alternate titles
"""
if self._aliases is None:
data = yield (self.ext + '/aliases')
data = yield self.ext + '/aliases'
self._aliases = [Alias(**alias) for alias in data]
yield self._aliases

Expand All @@ -172,7 +172,7 @@ def comments(self):
"""
# TODO (jnappi) Pagination
from trakt.users import User
data = yield (self.ext + '/comments')
data = yield self.ext + '/comments'
self._comments = []
for com in data:
user = User(**com.get('user'))
Expand Down Expand Up @@ -210,7 +210,7 @@ def people(self):
:class:`Movie`, including both cast and crew
"""
if self._people is None:
data = yield (self.ext + '/people')
data = yield self.ext + '/people'
crew = data.get('crew', {})
cast = []
for c in data.get('cast', []):
Expand All @@ -232,14 +232,14 @@ def people(self):
def ratings(self):
"""Ratings (between 0 and 10) and distribution for a movie."""
if self._ratings is None:
self._ratings = yield (self.ext + '/ratings')
self._ratings = yield self.ext + '/ratings'
yield self._ratings

@property
@get
def related(self):
"""The top 10 :class:`Movie`'s related to this :class:`Movie`"""
data = yield (self.ext + '/related')
data = yield self.ext + '/related'
movies = []
for movie in data:
movies.append(Movie(**movie))
Expand Down
26 changes: 13 additions & 13 deletions trakt/tv.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ def aliases(self):
they go by their alternate titles
"""
if self._aliases is None:
data = yield (self.ext + '/aliases')
data = yield self.ext + '/aliases'
self._aliases = [Alias(**alias) for alias in data]
yield self._aliases

Expand All @@ -288,7 +288,7 @@ def comments(self):
# TODO (jnappi) Pagination
from .users import User

data = yield (self.ext + '/comments')
data = yield self.ext + '/comments'
self._comments = []
for com in data:
user = User(**com.pop('user'))
Expand Down Expand Up @@ -338,7 +338,7 @@ def people(self):
:class:`TVShow`, including both cast and crew
"""
if self._people is None:
data = yield (self.ext + '/people')
data = yield self.ext + '/people'
crew = data.get('crew', {})
cast = []
for c in data.get('cast', []):
Expand All @@ -360,14 +360,14 @@ def people(self):
def ratings(self):
"""Ratings (between 0 and 10) and distribution for a movie."""
if self._ratings is None:
self._ratings = yield (self.ext + '/ratings')
self._ratings = yield self.ext + '/ratings'
yield self._ratings

@property
@get
def related(self):
"""The top 10 :class:`TVShow`'s related to this :class:`TVShow`"""
data = yield (self.ext + '/related')
data = yield self.ext + '/related'
shows = []
for show in data:
shows.append(TVShow(**show))
Expand All @@ -380,7 +380,7 @@ def seasons(self):
seasons
"""
if self._seasons is None:
data = yield (self.ext + '/seasons?extended=full')
data = yield self.ext + '/seasons?extended=full'
self._seasons = []
for season in data:
extract_ids(season)
Expand All @@ -395,7 +395,7 @@ def last_episode(self):
is found, `None` will be returned.
"""
if self._last_episode is None:
data = yield (self.ext + '/last_episode?extended=full')
data = yield self.ext + '/last_episode?extended=full'
self._last_episode = data and TVEpisode(show=self.title, **data)
yield self._last_episode

Expand All @@ -406,7 +406,7 @@ def next_episode(self):
is found, `None` will be returned.
"""
if self._next_episode is None:
data = yield (self.ext + '/next_episode?extended=full')
data = yield self.ext + '/next_episode?extended=full'
self._next_episode = data and TVEpisode(show=self.title, **data)
yield self._next_episode

Expand Down Expand Up @@ -545,7 +545,7 @@ def comments(self):
# TODO (jnappi) Pagination
from .users import User

data = yield (self.ext + '/comments')
data = yield self.ext + '/comments'
self._comments = []
for com in data:
user = User(**com.pop('user'))
Expand Down Expand Up @@ -583,7 +583,7 @@ def _episode_getter(self, episode):
"""
episode_extension = '/episodes/{}?extended=full'.format(episode)
try:
data = yield (self.ext + episode_extension)
data = yield self.ext + episode_extension
yield TVEpisode(show=self.show, **data)
except NotFoundException:
yield None
Expand All @@ -593,7 +593,7 @@ def _episode_getter(self, episode):
def ratings(self):
"""Ratings (between 0 and 10) and distribution for a movie."""
if self._ratings is None:
self._ratings = yield (self.ext + '/ratings')
self._ratings = yield self.ext + '/ratings'
yield self._ratings

@property
Expand Down Expand Up @@ -685,7 +685,7 @@ def comments(self):
# TODO (jnappi) Pagination
from .users import User

data = yield (self.ext + '/comments')
data = yield self.ext + '/comments'
self._comments = []
for com in data:
user = User(**com.pop('user'))
Expand Down Expand Up @@ -772,7 +772,7 @@ def end_time_from_custom_start(self, start_date=None):
def ratings(self):
"""Ratings (between 0 and 10) and distribution for a movie."""
if self._ratings is None:
self._ratings = yield (self.ext + '/ratings')
self._ratings = yield self.ext + '/ratings'
yield self._ratings

@property
Expand Down

0 comments on commit 982c3c5

Please sign in to comment.