Skip to content

Commit 63ad2b2

Browse files
Modify docstrings for used tuples
Move description of all fields into the main docstring for each NamedTuple.
1 parent 88c001a commit 63ad2b2

1 file changed

Lines changed: 125 additions & 147 deletions

File tree

src/simplejustwatchapi/tuples.py

Lines changed: 125 additions & 147 deletions
Original file line numberDiff line numberDiff line change
@@ -8,255 +8,233 @@ class OfferPackage(NamedTuple):
88
Parsed single offer package from JustWatch GraphQL API for single entry.
99
1010
Contains information about platform on which given offer is available.
11+
12+
Attributes:
13+
id (str): ID, defines whole platform on which this offer is available, not a single offer.
14+
package_id (int): Package ID, defines whole platform on which this offer is available,
15+
not a single offer.
16+
name (str): Name of the platform in format suited to display for users.
17+
technical_name (str): Technical name of the platform,
18+
usually all lowercase with no whitespaces.
19+
icon (str): Platform icon URL.
20+
1121
"""
1222

1323
id: str
14-
"""ID, defines whole platform on which this offer is available, not a single offer."""
15-
1624
package_id: int
17-
"""Package ID, defines whole platform on which this offer is available, not a single offer."""
18-
1925
name: str
20-
"""Name of the platform in format suited to display for users."""
21-
2226
technical_name: str
23-
"""Technical name of the platform, usually all lowercase with no whitespaces."""
24-
2527
icon: str
26-
"""Platform icon URL."""
2728

2829

2930
class Offer(NamedTuple):
3031
"""
3132
Parsed single offer from JustWatch GraphQL API for single entry.
3233
3334
One platform can have multiple offers for one entry available, e.g. renting, buying, etc.
35+
36+
Attributes:
37+
id (str): Offer ID.
38+
monetization_type (str): Type of monetization of this offer,
39+
e.g. ``FLATRATE`` (streaming), ``RENT``, ``BUY``.
40+
presentation_type (str): Quality of media in this offer, e.g. ``HD``, ``SD``, ``4K``.
41+
price_string (str | None): Current price as a string with currency,
42+
suitable for displaying to users. Format can change based on used ``language`` argument.
43+
price_value (float | None): Current price as a numeric value.
44+
price_currency (str): Represents only currency, without price, or value.
45+
last_change_retail_price_value (float | None): Previous available price if change in price
46+
was recorded.
47+
type (str): Type of offer.
48+
package (OfferPackage): Information about platform on which this offer is available.
49+
url (str): URL to this offer.
50+
element_count (int | None): Element count, usually ``0``.
51+
available_to (str | None): Date until which this offer will be available.
52+
deeplink_roku (str | None): Deeplink to this offer in Roku.
53+
subtitle_languages (list[str]): List of 2-letter language codes of available subtitles,
54+
e.g. ``["en", "pt", "de"]``.
55+
video_technology (list[str]): List of known video technologies available in this offer,
56+
e.g. ``DOLBY_VISION``.
57+
audio_technology (list[str]): List of known audio technologies available in this offer,
58+
e.g. ``DOLBY_ATMOS``.
59+
audio_languages (list[str]): List of 2-letter language codes of available audio tracks,
60+
e.g. ``["en", "pt", "de"]``.
61+
3462
"""
3563

3664
id: str
37-
"""Offer ID."""
38-
3965
monetization_type: str
40-
"""Type of monetization of this offer, e.g. ``FLATRATE`` (streaming), ``RENT``, ``BUY``."""
41-
4266
presentation_type: str
43-
"""Quality of media in this offer, e.g. ``HD``, ``SD``, ``4K``."""
44-
4567
price_string: str | None
46-
"""Current price as a string with currency, suitable for displaying to users.
47-
Format can change based on used ``language`` argument."""
48-
4968
price_value: float | None
50-
"""Current price as a numeric value."""
51-
5269
price_currency: str
53-
"""Represents only currency, without price, or value."""
54-
5570
last_change_retail_price_value: float | None
56-
"""Previous available price if change in price was recorded."""
57-
5871
type: str
59-
"""Type of offer."""
60-
6172
package: OfferPackage
62-
"""Information about platform on which this offer is available."""
63-
6473
url: str
65-
"""URL to this offer."""
66-
6774
element_count: int | None
68-
"""Element count, usually 0."""
69-
7075
available_to: str | None
71-
"""Date until which this offer will be available."""
72-
7376
deeplink_roku: str | None
74-
"""Deeplink to this offer in Roku."""
75-
7677
subtitle_languages: list[str]
77-
"""List of 2-letter language codes of available subtitles, e.g. ``["en", "pt", "de"]``."""
78-
7978
video_technology: list[str]
80-
"""List of known video technologies available in this offer, e.g. ``DOLBY_VISION``."""
81-
8279
audio_technology: list[str]
83-
"""List of known audio technologies available in this offer, e.g. ``DOLBY_ATMOS``."""
84-
8580
audio_languages: list[str]
86-
"""List of 2-letter language codes of available audio tracks, e.g. ``["en", "pt", "de"]``."""
8781

8882

8983
class Scoring(NamedTuple):
90-
"""Parsed data related to user scoring for a single entry."""
84+
"""
85+
Parsed data related to user scoring for a single entry.
86+
87+
Attributes:
88+
imdb_score (float | None): IMDB score.
89+
imdb_votes (int | None): Number of votes on IMDB.
90+
tmdb_popularity (float | None): TMDB popularity score.
91+
tmdb_score (float | None): TMDB score.
92+
tomatometer (int | None): Tomatometer score on Rotten Tomatoes.
93+
certified_fresh (bool | None): Flag whether entry has "Certified Fresh" seal
94+
on Rotten Tomatoes.
95+
jw_rating (float | None): JustWatch rating.
9196
92-
imdb_score: float | None
93-
"""IMDB score."""
97+
"""
9498

99+
imdb_score: float | None
95100
imdb_votes: int | None
96-
"""Number of votes on IMDB."""
97-
98101
tmdb_popularity: float | None
99-
"""TMDB popularity score."""
100-
101102
tmdb_score: float | None
102-
"""TMDB score."""
103-
104103
tomatometer: int | None
105-
"""Tomatometer score on Rotten Tomatoes."""
106-
107104
certified_fresh: bool | None
108-
"""Flag whether entry has "Certified Fresh" seal on Rotten Tomatoes."""
109-
110105
jw_rating: float | None
111-
"""JustWatch rating."""
112106

113107

114108
class Interactions(NamedTuple):
115-
"""Parsed data regarding number of likes and dislikes on JustWatch for a single entry."""
109+
"""
110+
Parsed data regarding number of likes and dislikes on JustWatch for a single entry.
116111
117-
likes: int | None
118-
"""Number of likes on JustWatch."""
112+
Attributes:
113+
likes (int | None): Number of likes on JustWatch.
114+
dislikes (int | None): Number of dislikes on JustWatch.
115+
116+
"""
119117

118+
likes: int | None
120119
dislikes: int | None
121-
"""Number of dislikes on JustWatch."""
122120

123121

124122
class StreamingCharts(NamedTuple):
125-
"""Parsed data related to JustWatch rank for a single entry."""
123+
"""
124+
Parsed data related to JustWatch rank for a single entry.
125+
126+
Attributes:
127+
rank (int): Rank on JustWatch.
128+
trend (str): Trend in ranking on JustWatch, ``UP``, ``DOWN``, ``STABLE``.
129+
trend_difference (int): Difference in rank; related to trend.
130+
top_rank (int): Top rank ever reached.
131+
days_in_top_3 (int): Number of days in top 3 ranks.
132+
days_in_top_10 (int): Number of days in top 10 ranks.
133+
days_in_top_100 (int): Number of days in top 100 ranks.
134+
days_in_top_1000 (int): Number of days in top 1000 ranks.
135+
updated (str): Date when rank data was last updated as a string,
136+
e.g.: ``2024-10-06T09:20:36.397Z``.
126137
127-
rank: int
128-
"""Rank on JustWatch."""
138+
"""
129139

140+
rank: int
130141
trend: str
131-
"""Trend in ranking on JustWatch, ``UP``, ``DOWN``, ``STABLE``."""
132-
133142
trend_difference: int
134-
"""Difference in rank; related to trend."""
135-
136143
top_rank: int
137-
"""Top rank ever reached."""
138-
139144
days_in_top_3: int
140-
"""Number of days in top 3 ranks."""
141-
142145
days_in_top_10: int
143-
"""Number of days in top 10 ranks."""
144-
145146
days_in_top_100: int
146-
"""Number of days in top 100 ranks."""
147-
148147
days_in_top_1000: int
149-
"""Number of days in top 1000 ranks."""
150-
151148
updated: str
152-
"""Date when rank data was last updated as a string, e.g.: ``2024-10-06T09:20:36.397Z``."""
153149

154150

155151
class Episode(NamedTuple):
156-
"""Parsed data related to a single episode."""
152+
"""
153+
Parsed data related to a single episode.
154+
155+
Attributes:
156+
episode_id (str): Episode ID, contains type code and numeric ID.
157+
object_id (int): Object ID, the numeric part of full episode ID.
158+
object_type (str): Type of entry, for episodes should be ``SHOW_EPISODE``.
159+
title (str | None): Full title.
160+
release_year (int | None): Release year as a number.
161+
release_date (str | None): Full release date as a string, e.g. ``2013-12-16``.
162+
runtime_minutes (int | None): Runtime in minutes.
163+
short_description (str | None): Short description of this episode.
164+
episode_number (int | None): Number of this episode.
165+
season_number (int | None): Season number with this episode.
166+
offers (list[Offer]): List of available offers for this episode,
167+
empty if there are no available offers.
157168
158-
episode_id: str
159-
"""Episode ID, contains type code and numeric ID."""
169+
"""
160170

171+
episode_id: str
161172
object_id: int
162-
"""Object ID, the numeric part of full episode ID."""
163-
164173
object_type: str
165-
"""Type of entry, for episodes should be ``SHOW_EPISODE``."""
166-
167174
title: str | None
168-
"""Full title."""
169-
170175
release_year: int | None
171-
"""Release year as a number."""
172-
173176
release_date: str | None
174-
"""Full release date as a string, e.g. ``2013-12-16``."""
175-
176177
runtime_minutes: int | None
177-
"""Runtime in minutes."""
178-
179178
short_description: str | None
180-
"""Short description of this episode."""
181-
182179
episode_number: int | None
183-
"""Number of this episode."""
184-
185180
season_number: int | None
186-
"""Season number with this episode."""
187-
188181
offers: list[Offer]
189-
"""List of available offers for this episode, empty if there are no available offers."""
190182

191183

192184
class MediaEntry(NamedTuple):
193-
"""Parsed response from JustWatch GraphQL API for "GetSearchTitles" query for single entry."""
185+
"""
186+
Parsed response from JustWatch GraphQL API for "GetSearchTitles" query for single entry.
187+
188+
Attributes:
189+
entry_id (str): Entry ID, contains type code and numeric ID.
190+
object_id (int): Object ID, the numeric part of full entry ID.
191+
object_type (str): Type of entry, e.g. ``MOVIE``, ``SHOW``.
192+
title (str): Full title.
193+
url (str): URL to JustWatch with details for this entry.
194+
release_year (int): Release year as a number.
195+
release_date (str): Full release date as a string, e.g. ``2013-12-16``.
196+
runtime_minutes (int): Runtime in minutes.
197+
short_description (str): Short description of this entry.
198+
genres (list[str]): List of genre codes for this entry,
199+
e.g. ``["rly"]``, ``["cmy", "drm", "rma"]``.
200+
imdb_id (str | None): ID of this entry in IMDB.
201+
tmdb_id (str | None): ID of this entry in TMDB.
202+
poster (str | None): URL to poster for this ID.
203+
backdrops (list[str]): List of URLs for backdrops (full screen images to use as background).
204+
age_certification (str | None): Age rating as a string, e.g.: ``R``, ``TV-14``.
205+
scoring (Scoring | None): Scoring data.
206+
interactions (Interactions | None): Interactions (likes/dislikes) data.
207+
streaming_charts (StreamingCharts | None): JustWatch charts/ranks data.
208+
offers (list[Offer]): List of available offers for this entry,
209+
empty if there are no available offers.
210+
total_season_count (int | None): Total season count, for non-shows it's always ``None``.
211+
total_episode_count (int | None): Total number of episodes in this season,
212+
for non-seasons it's always ``None``.
213+
season_number (int | None): Number of this season, for movies it's always ``None``.
214+
episode_number (int | None): Number of this episode, for non-episodes it's always ``None``.
194215
195-
entry_id: str
196-
"""Entry ID, contains type code and numeric ID."""
216+
"""
197217

218+
entry_id: str
198219
object_id: int
199-
"""Object ID, the numeric part of full entry ID."""
200-
201220
object_type: str
202-
"""Type of entry, e.g. ``MOVIE``, ``SHOW``."""
203-
204221
title: str
205-
"""Full title."""
206-
207222
url: str
208-
"""URL to JustWatch with details for this entry."""
209-
210223
release_year: int
211-
"""Release year as a number."""
212-
213224
release_date: str
214-
"""Full release date as a string, e.g. ``2013-12-16``."""
215-
216225
runtime_minutes: int
217-
"""Runtime in minutes."""
218-
219226
short_description: str
220-
"""Short description of this entry."""
221-
222227
genres: list[str]
223-
"""List of genre codes for this entry, e.g. ``["rly"]``, ``["cmy", "drm", "rma"]``."""
224-
225228
imdb_id: str | None
226-
"""ID of this entry in IMDB."""
227-
228229
tmdb_id: str | None
229-
"""ID of this entry in TMDB."""
230-
231230
poster: str | None
232-
"""URL to poster for this ID."""
233-
234231
backdrops: list[str]
235-
"""List of URLs for backdrops (full screen images to use as background)."""
236-
237232
age_certification: str | None
238-
"""Age rating as a string, e.g.: "R", "TV-14"."""
239-
240233
scoring: Scoring | None
241-
"""Scoring data."""
242-
243234
interactions: Interactions | None
244-
"""Interactions (likes/dislikes) data."""
245-
246235
streaming_charts: StreamingCharts | None
247-
"""JustWatch charts/ranks data."""
248-
249236
offers: list[Offer]
250-
"""List of available offers for this entry, empty if there are no available offers."""
251-
252237
total_season_count: int | None
253-
"""Total season count, for non-shows it's always None."""
254-
255238
total_episode_count: int | None
256-
"""Total number of episodes in this season, for non-seasons it's always "None"."""
257-
258239
season_number: int | None
259-
"""Number of this season, for movies it's always "None"."""
260-
261240
episode_number: int | None
262-
"""Number of this episode, for non-episodes it's always "None"."""

0 commit comments

Comments
 (0)