diff options
author | Mike Crute <mike@crute.us> | 2017-10-07 04:12:33 +0000 |
---|---|---|
committer | Mike Crute <mike@crute.us> | 2017-10-07 04:37:42 +0000 |
commit | 24281ca6994de79ce36a7d1805a5392590a1c22c (patch) | |
tree | a22ecc7e88b24655a81c1c3ac1aac3583ec92ee1 | |
parent | eac047b29356b98c368a0a420d1abcd089ac8b09 (diff) | |
download | pydora-24281ca6994de79ce36a7d1805a5392590a1c22c.tar.bz2 pydora-24281ca6994de79ce36a7d1805a5392590a1c22c.tar.xz pydora-24281ca6994de79ce36a7d1805a5392590a1c22c.zip |
Add no-cover pragmas
-rw-r--r-- | pandora/client.py | 58 | ||||
-rw-r--r-- | pandora/models/pandora.py | 26 |
2 files changed, 41 insertions, 43 deletions
diff --git a/pandora/client.py b/pandora/client.py index 48077cb..0eaa977 100644 --- a/pandora/client.py +++ b/pandora/client.py | |||
@@ -43,14 +43,14 @@ class BaseAPIClient(object): | |||
43 | @classmethod | 43 | @classmethod |
44 | @deprecated("1.3", "2.0", | 44 | @deprecated("1.3", "2.0", |
45 | "Replaced by clientbuilder.SettingsDictBuilder") | 45 | "Replaced by clientbuilder.SettingsDictBuilder") |
46 | def from_settings_dict(cls, settings): | 46 | def from_settings_dict(cls, settings): # pragma: no cover |
47 | from .clientbuilder import SettingsDictBuilder | 47 | from .clientbuilder import SettingsDictBuilder |
48 | return SettingsDictBuilder(settings).build() | 48 | return SettingsDictBuilder(settings).build() |
49 | 49 | ||
50 | @classmethod | 50 | @classmethod |
51 | @deprecated("1.3", "2.0", | 51 | @deprecated("1.3", "2.0", |
52 | "Replaced by clientbuilder.PydoraConfigFileBuilder") | 52 | "Replaced by clientbuilder.PydoraConfigFileBuilder") |
53 | def from_config_file(cls, path, authenticate=True): | 53 | def from_config_file(cls, path, authenticate=True): # pragma: no cover |
54 | from .clientbuilder import PydoraConfigFileBuilder | 54 | from .clientbuilder import PydoraConfigFileBuilder |
55 | return PydoraConfigFileBuilder(path, authenticate).build() | 55 | return PydoraConfigFileBuilder(path, authenticate).build() |
56 | 56 | ||
@@ -117,14 +117,14 @@ class APIClient(BaseAPIClient): | |||
117 | This is what clients should actually use. | 117 | This is what clients should actually use. |
118 | """ | 118 | """ |
119 | 119 | ||
120 | def get_station_list(self): | 120 | def get_station_list(self): # pragma: no cover |
121 | from .models.pandora import StationList | 121 | from .models.pandora import StationList |
122 | 122 | ||
123 | return StationList.from_json(self, | 123 | return StationList.from_json(self, |
124 | self("user.getStationList", | 124 | self("user.getStationList", |
125 | includeStationArtUrl=True)) | 125 | includeStationArtUrl=True)) |
126 | 126 | ||
127 | def get_station_list_checksum(self): | 127 | def get_station_list_checksum(self): # pragma: no cover |
128 | return self("user.getStationListChecksum")["checksum"] | 128 | return self("user.getStationListChecksum")["checksum"] |
129 | 129 | ||
130 | def get_playlist(self, station_token): | 130 | def get_playlist(self, station_token): |
@@ -144,13 +144,13 @@ class APIClient(BaseAPIClient): | |||
144 | 144 | ||
145 | return playlist | 145 | return playlist |
146 | 146 | ||
147 | def get_bookmarks(self): | 147 | def get_bookmarks(self): # pragma: no cover |
148 | from .models.pandora import BookmarkList | 148 | from .models.pandora import BookmarkList |
149 | 149 | ||
150 | return BookmarkList.from_json(self, | 150 | return BookmarkList.from_json(self, |
151 | self("user.getBookmarks")) | 151 | self("user.getBookmarks")) |
152 | 152 | ||
153 | def get_station(self, station_token): | 153 | def get_station(self, station_token): # pragma: no cover |
154 | from .models.pandora import Station | 154 | from .models.pandora import Station |
155 | 155 | ||
156 | return Station.from_json(self, | 156 | return Station.from_json(self, |
@@ -158,25 +158,25 @@ class APIClient(BaseAPIClient): | |||
158 | stationToken=station_token, | 158 | stationToken=station_token, |
159 | includeExtendedAttributes=True)) | 159 | includeExtendedAttributes=True)) |
160 | 160 | ||
161 | def add_artist_bookmark(self, track_token): | 161 | def add_artist_bookmark(self, track_token): # pragma: no cover |
162 | return self("bookmark.addArtistBookmark", | 162 | return self("bookmark.addArtistBookmark", |
163 | trackToken=track_token) | 163 | trackToken=track_token) |
164 | 164 | ||
165 | def add_song_bookmark(self, track_token): | 165 | def add_song_bookmark(self, track_token): # pragma: no cover |
166 | return self("bookmark.addSongBookmark", | 166 | return self("bookmark.addSongBookmark", |
167 | trackToken=track_token) | 167 | trackToken=track_token) |
168 | 168 | ||
169 | def delete_song_bookmark(self, bookmark_token): | 169 | def delete_song_bookmark(self, bookmark_token): # pragma: no cover |
170 | return self("bookmark.deleteSongBookmark", | 170 | return self("bookmark.deleteSongBookmark", |
171 | bookmarkToken=bookmark_token) | 171 | bookmarkToken=bookmark_token) |
172 | 172 | ||
173 | def delete_artist_bookmark(self, bookmark_token): | 173 | def delete_artist_bookmark(self, bookmark_token): # pragma: no cover |
174 | return self("bookmark.deleteArtistBookmark", | 174 | return self("bookmark.deleteArtistBookmark", |
175 | bookmarkToken=bookmark_token) | 175 | bookmarkToken=bookmark_token) |
176 | 176 | ||
177 | def search(self, search_text, | 177 | def search(self, search_text, |
178 | include_near_matches=False, | 178 | include_near_matches=False, |
179 | include_genre_stations=False): | 179 | include_genre_stations=False): # pragma: no cover |
180 | from .models.pandora import SearchResult | 180 | from .models.pandora import SearchResult |
181 | 181 | ||
182 | return SearchResult.from_json( | 182 | return SearchResult.from_json( |
@@ -187,12 +187,12 @@ class APIClient(BaseAPIClient): | |||
187 | includeGenreStations=include_genre_stations) | 187 | includeGenreStations=include_genre_stations) |
188 | ) | 188 | ) |
189 | 189 | ||
190 | def add_feedback(self, track_token, positive): | 190 | def add_feedback(self, track_token, positive): # pragma: no cover |
191 | return self("station.addFeedback", | 191 | return self("station.addFeedback", |
192 | trackToken=track_token, | 192 | trackToken=track_token, |
193 | isPositive=positive) | 193 | isPositive=positive) |
194 | 194 | ||
195 | def add_music(self, music_token, station_token): | 195 | def add_music(self, music_token, station_token): # pragma: no cover |
196 | return self("station.addMusic", | 196 | return self("station.addMusic", |
197 | musicToken=music_token, | 197 | musicToken=music_token, |
198 | stationToken=station_token) | 198 | stationToken=station_token) |
@@ -212,58 +212,58 @@ class APIClient(BaseAPIClient): | |||
212 | 212 | ||
213 | return self("station.createStation", **kwargs) | 213 | return self("station.createStation", **kwargs) |
214 | 214 | ||
215 | def delete_feedback(self, feedback_id): | 215 | def delete_feedback(self, feedback_id): # pragma: no cover |
216 | return self("station.deleteFeedback", | 216 | return self("station.deleteFeedback", |
217 | feedbackId=feedback_id) | 217 | feedbackId=feedback_id) |
218 | 218 | ||
219 | def delete_music(self, seed_id): | 219 | def delete_music(self, seed_id): # pragma: no cover |
220 | return self("station.deleteMusic", | 220 | return self("station.deleteMusic", |
221 | seedId=seed_id) | 221 | seedId=seed_id) |
222 | 222 | ||
223 | def delete_station(self, station_token): | 223 | def delete_station(self, station_token): # pragma: no cover |
224 | return self("station.deleteStation", | 224 | return self("station.deleteStation", |
225 | stationToken=station_token) | 225 | stationToken=station_token) |
226 | 226 | ||
227 | def get_genre_stations(self): | 227 | def get_genre_stations(self): |
228 | from .models.pandora import GenreStationList | 228 | from .models.pandora import GenreStationList |
229 | 229 | ||
230 | genres = self("station.getGenreStations") | 230 | genre_stations = GenreStationList.from_json( |
231 | 231 | self, self("station.getGenreStations")) | |
232 | genre_stations = GenreStationList.from_json(self, genres) | ||
233 | genre_stations.checksum = self.get_genre_stations_checksum() | 232 | genre_stations.checksum = self.get_genre_stations_checksum() |
233 | |||
234 | return genre_stations | 234 | return genre_stations |
235 | 235 | ||
236 | def get_genre_stations_checksum(self): | 236 | def get_genre_stations_checksum(self): # pragma: no cover |
237 | return self("station.getGenreStationsChecksum")["checksum"] | 237 | return self("station.getGenreStationsChecksum")["checksum"] |
238 | 238 | ||
239 | def rename_station(self, station_token, name): | 239 | def rename_station(self, station_token, name): # pragma: no cover |
240 | return self("station.renameStation", | 240 | return self("station.renameStation", |
241 | stationToken=station_token, | 241 | stationToken=station_token, |
242 | stationName=name) | 242 | stationName=name) |
243 | 243 | ||
244 | def explain_track(self, track_token): | 244 | def explain_track(self, track_token): # pragma: no cover |
245 | return self("track.explainTrack", | 245 | return self("track.explainTrack", |
246 | trackToken=track_token) | 246 | trackToken=track_token) |
247 | 247 | ||
248 | def set_quick_mix(self, *args): | 248 | def set_quick_mix(self, *args): # pragma: no cover |
249 | return self("user.setQuickMix", | 249 | return self("user.setQuickMix", |
250 | quickMixStationIds=args) | 250 | quickMixStationIds=args) |
251 | 251 | ||
252 | def sleep_song(self, track_token): | 252 | def sleep_song(self, track_token): # pragma: no cover |
253 | return self("user.sleepSong", | 253 | return self("user.sleepSong", |
254 | trackToken=track_token) | 254 | trackToken=track_token) |
255 | 255 | ||
256 | def share_station(self, station_id, station_token, *emails): | 256 | def share_station(self, station_id, station_token, *emails): # pragma: nc |
257 | return self("station.shareStation", | 257 | return self("station.shareStation", |
258 | stationId=station_id, | 258 | stationId=station_id, |
259 | stationToken=station_token, | 259 | stationToken=station_token, |
260 | emails=emails) | 260 | emails=emails) |
261 | 261 | ||
262 | def transform_shared_station(self, station_token): | 262 | def transform_shared_station(self, station_token): # pragma: no cover |
263 | return self("station.transformSharedStation", | 263 | return self("station.transformSharedStation", |
264 | stationToken=station_token) | 264 | stationToken=station_token) |
265 | 265 | ||
266 | def share_music(self, music_token, *emails): | 266 | def share_music(self, music_token, *emails): # pragma: no cover |
267 | return self("music.shareMusic", | 267 | return self("music.shareMusic", |
268 | musicToken=music_token, | 268 | musicToken=music_token, |
269 | email=emails[0]) | 269 | email=emails[0]) |
@@ -281,13 +281,13 @@ class APIClient(BaseAPIClient): | |||
281 | ad_item.ad_token = ad_token | 281 | ad_item.ad_token = ad_token |
282 | return ad_item | 282 | return ad_item |
283 | 283 | ||
284 | def get_ad_metadata(self, ad_token): | 284 | def get_ad_metadata(self, ad_token): # pragma: no cover |
285 | return self("ad.getAdMetadata", | 285 | return self("ad.getAdMetadata", |
286 | adToken=ad_token, | 286 | adToken=ad_token, |
287 | returnAdTrackingTokens=True, | 287 | returnAdTrackingTokens=True, |
288 | supportAudioAds=True) | 288 | supportAudioAds=True) |
289 | 289 | ||
290 | def register_ad(self, station_id, tokens): | 290 | def register_ad(self, station_id, tokens): # pragma: no cover |
291 | return self("ad.registerAd", | 291 | return self("ad.registerAd", |
292 | stationId=station_id, | 292 | stationId=station_id, |
293 | adTrackingTokens=tokens) | 293 | adTrackingTokens=tokens) |
diff --git a/pandora/models/pandora.py b/pandora/models/pandora.py index c041b40..455bcf3 100644 --- a/pandora/models/pandora.py +++ b/pandora/models/pandora.py | |||
@@ -33,7 +33,7 @@ class GenreStation(PandoraModel): | |||
33 | token = Field("stationToken") | 33 | token = Field("stationToken") |
34 | category = Field("categoryName") | 34 | category = Field("categoryName") |
35 | 35 | ||
36 | def get_playlist(self): | 36 | def get_playlist(self): # pragma: no cover |
37 | raise NotImplementedError("Genre stations do not have playlists. " | 37 | raise NotImplementedError("Genre stations do not have playlists. " |
38 | "Create a real station using the token.") | 38 | "Create a real station using the token.") |
39 | 39 | ||
@@ -170,19 +170,19 @@ class PlaylistModel(PandoraModel): | |||
170 | """ | 170 | """ |
171 | return self | 171 | return self |
172 | 172 | ||
173 | def thumbs_up(self): | 173 | def thumbs_up(self): # pragma: no cover |
174 | raise NotImplementedError | 174 | raise NotImplementedError |
175 | 175 | ||
176 | def thumbs_down(self): | 176 | def thumbs_down(self): # pragma: no cover |
177 | raise NotImplementedError | 177 | raise NotImplementedError |
178 | 178 | ||
179 | def bookmark_song(self): | 179 | def bookmark_song(self): # pragma: no cover |
180 | raise NotImplementedError | 180 | raise NotImplementedError |
181 | 181 | ||
182 | def bookmark_artist(self): | 182 | def bookmark_artist(self): # pragma: no cover |
183 | raise NotImplementedError | 183 | raise NotImplementedError |
184 | 184 | ||
185 | def sleep(self): | 185 | def sleep(self): # pragma: no cover |
186 | raise NotImplementedError | 186 | raise NotImplementedError |
187 | 187 | ||
188 | 188 | ||
@@ -224,19 +224,19 @@ class PlaylistItem(PlaylistModel): | |||
224 | def is_ad(self): | 224 | def is_ad(self): |
225 | return self.ad_token is not None | 225 | return self.ad_token is not None |
226 | 226 | ||
227 | def thumbs_up(self): | 227 | def thumbs_up(self): # pragma: no cover |
228 | return self._api_client.add_feedback(self.track_token, True) | 228 | return self._api_client.add_feedback(self.track_token, True) |
229 | 229 | ||
230 | def thumbs_down(self): | 230 | def thumbs_down(self): # pragma: no cover |
231 | return self._api_client.add_feedback(self.track_token, False) | 231 | return self._api_client.add_feedback(self.track_token, False) |
232 | 232 | ||
233 | def bookmark_song(self): | 233 | def bookmark_song(self): # pragma: no cover |
234 | return self._api_client.add_song_bookmark(self.track_token) | 234 | return self._api_client.add_song_bookmark(self.track_token) |
235 | 235 | ||
236 | def bookmark_artist(self): | 236 | def bookmark_artist(self): # pragma: no cover |
237 | return self._api_client.add_artist_bookmark(self.track_token) | 237 | return self._api_client.add_artist_bookmark(self.track_token) |
238 | 238 | ||
239 | def sleep(self): | 239 | def sleep(self): # pragma: no cover |
240 | return self._api_client.sleep_song(self.track_token) | 240 | return self._api_client.sleep_song(self.track_token) |
241 | 241 | ||
242 | 242 | ||
@@ -333,17 +333,15 @@ class SearchResultItem(PandoraModel): | |||
333 | def is_genre_station(self): | 333 | def is_genre_station(self): |
334 | return isinstance(self, GenreStationSearchResultItem) | 334 | return isinstance(self, GenreStationSearchResultItem) |
335 | 335 | ||
336 | def create_station(self): | 336 | def create_station(self): # pragma: no cover |
337 | raise NotImplementedError | 337 | raise NotImplementedError |
338 | 338 | ||
339 | @classmethod | 339 | @classmethod |
340 | def from_json(cls, api_client, data): | 340 | def from_json(cls, api_client, data): |
341 | if data["musicToken"].startswith("S"): | 341 | if data["musicToken"].startswith("S"): |
342 | return SongSearchResultItem.from_json(api_client, data) | 342 | return SongSearchResultItem.from_json(api_client, data) |
343 | |||
344 | elif data["musicToken"].startswith(("R", "C")): | 343 | elif data["musicToken"].startswith(("R", "C")): |
345 | return ArtistSearchResultItem.from_json(api_client, data) | 344 | return ArtistSearchResultItem.from_json(api_client, data) |
346 | |||
347 | elif data["musicToken"].startswith("G"): | 345 | elif data["musicToken"].startswith("G"): |
348 | return GenreStationSearchResultItem.from_json(api_client, data) | 346 | return GenreStationSearchResultItem.from_json(api_client, data) |
349 | else: | 347 | else: |