Skip to content

Commit ac66b5f

Browse files
Tweak docstrings in "justwatch.py"
Split long argument rescriptions into multiple lines.
1 parent 7af4b81 commit ac66b5f

1 file changed

Lines changed: 169 additions & 75 deletions

File tree

src/simplejustwatchapi/justwatch.py

Lines changed: 169 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -95,42 +95,60 @@ def search(
9595
Args:
9696
title (str): Title to search. Not stripped, passed to the API as-is.
9797
98-
country (str): 2-letter country code for which offers are selected. It should be
99-
uppercase, however it will be normalized to uppercase automatically. It
100-
**must** be 2-letters long. It seems to be **ISO 3166-1 alpha-2** code,
98+
country (str): 2-letter country code for which offers are selected.
99+
100+
It should be uppercase, however it will be normalized to uppercase
101+
automatically.
102+
103+
It **must** be 2-letters long and seems to be **ISO 3166-1 alpha-2** code,
101104
however the API doesn't specify exact standard. If unexpected code is used,
102105
then [`JustWatchApiError`][simplejustwatchapi.exceptions.JustWatchApiError]
103106
exception is raised, as the API will respond with internal error.
104107
105108
language (str): Code for language in response (e.g., description, title).
109+
106110
In most basic form it's 2 lowercase letters (e.g., `en`, `de`).
107111
It can also contain alphanumeric (in uppercase) suffix after `-` symbol,
108112
most likely used for regional variants (e.g., `en-US`, `de-CH1901`).
113+
109114
It looks like a variant of **IETF BCP 47**, however the suffix can contain
110-
only uppercase letters and numbers. Its value isn't normalized and **must**
111-
be provided in expected format, including letter case.
115+
only uppercase letters and numbers.
116+
117+
Its value isn't normalized and **must** be provided in expected format,
118+
including letter case.
112119
113-
count (int): Return up to this many results. Too high values can cause API
114-
errors due to too high operation complexity, if you need more results, use
115-
with `offset` argument to get them in batches.
120+
count (int): Return up to this many results.
121+
122+
Too high values can cause API errors due to too high operation complexity,
123+
if you need more results, use with `offset` argument to get them in batches.
116124
117125
best_only (bool): Return only best offers if `True`, return all offers if
118-
`False`. If service offers the same title in 4K, HD, and SD, then
119-
`best_only = True` returns only 4K, `best_only = False` returns all three.
126+
`False`.
127+
128+
If service offers the same title in 4K, HD, and SD, then `best_only = True`
129+
returns only 4K, `best_only = False` returns all three.
120130
121131
offset (int): Offset for the first returned result, i.e. how many first entries
122-
should be skipped. This is done on API side, not the library side;
123-
the returned list is still directly parsed from API response. I'm not sure
124-
if it guarantees stability of results - if repeated calls to this function
125-
with increasing offset will guarantee that you won't get repeats.
132+
should be skipped.
133+
134+
This is done on API side, not the library side; the returned list is still
135+
directly parsed from API response.
136+
137+
I'm not sure if it guarantees stability of results - if repeated calls to
138+
this function with increasing offset will guarantee that you won't get
139+
repeats.
126140
127141
providers (list[str] | str | None): Selection of 3-letter service identifiers
128-
(e.g, `nfx` for "Netflix). Only entries which are available for given
129-
providers will be returned. For single provider you can either pass a single
130-
string, or a list of one string. For `None` (the default value) entries for
131-
all providers will be looked up. Invalid names will be ignored, however if
132-
all are invalid, then no filtering will be done. You can look up values
133-
through [`providers`] [simplejustwatchapi.justwatch.providers] function.
142+
(e.g, `nfx` for "Netflix"), only entries which are available for given
143+
providers will be returned.
144+
145+
For single provider you can either pass a single string, or a list of one
146+
string. For `None` (the default value) entries for all providers will be
147+
looked up.
148+
149+
Invalid names will be ignored, however if all are invalid, then no filtering
150+
will be done. You can look up values through [`providers`]
151+
[simplejustwatchapi.justwatch.providers] function.
134152
135153
Returns:
136154
(list[MediaEntry]): List of tuples with details of search results.
@@ -166,37 +184,60 @@ def popular(
166184
empty list instead (**always** an empty list, it won't include entries up to 1999).
167185
168186
Args:
169-
country (str): 2-letter country code for which offers are selected. It should be
170-
uppercase, however it will be normalized to uppercase automatically. It
171-
**must** be 2-letters long. It seems to be **ISO 3166-1 alpha-2** code,
187+
country (str): 2-letter country code for which offers are selected.
188+
189+
It should be uppercase, however it will be normalized to uppercase
190+
automatically.
191+
192+
It **must** be 2-letters long and seems to be **ISO 3166-1 alpha-2** code,
172193
however the API doesn't specify exact standard. If unexpected code is used,
173194
then [`JustWatchApiError`][simplejustwatchapi.exceptions.JustWatchApiError]
174195
exception is raised, as the API will respond with internal error.
196+
175197
language (str): Code for language in response (e.g., description, title).
198+
176199
In most basic form it's 2 lowercase letters (e.g., `en`, `de`).
177200
It can also contain alphanumeric (in uppercase) suffix after `-` symbol,
178201
most likely used for regional variants (e.g., `en-US`, `de-CH1901`).
202+
179203
It looks like a variant of **IETF BCP 47**, however the suffix can contain
180-
only uppercase letters and numbers. Its value isn't normalized and **must**
181-
be provided in expected format, including letter case.
182-
count (int): Return up to this many results. Too high values can cause API
183-
errors due to too high operation complexity, if you need more results, use
184-
with `offset` argument to get them in batches.
204+
only uppercase letters and numbers.
205+
206+
Its value isn't normalized and **must** be provided in expected format,
207+
including letter case.
208+
209+
count (int): Return up to this many results.
210+
211+
Too high values can cause API errors due to too high operation complexity,
212+
if you need more results, use with `offset` argument to get them in batches.
213+
185214
best_only (bool): Return only best offers if `True`, return all offers if
186-
`False`. If service offers the same title in 4K, HD, and SD, then
187-
`best_only = True` returns only 4K, `best_only = False` returns all three.
215+
`False`.
216+
217+
If service offers the same title in 4K, HD, and SD, then `best_only = True`
218+
returns only 4K, `best_only = False` returns all three.
219+
188220
offset (int): Offset for the first returned result, i.e. how many first entries
189-
should be skipped. This is done on API side, not the library side;
190-
the returned list is still directly parsed from API response. I'm not sure
191-
if it guarantees stability of results - if repeated calls to this function
192-
with increasing offset will guarantee that you won't get repeats.
221+
should be skipped.
222+
223+
This is done on API side, not the library side; the returned list is still
224+
directly parsed from API response.
225+
226+
I'm not sure if it guarantees stability of results - if repeated calls to
227+
this function with increasing offset will guarantee that you won't get
228+
repeats.
229+
193230
providers (list[str] | str | None): Selection of 3-letter service identifiers
194-
(e.g, `nfx` for "Netflix). Only entries which are available for given
195-
providers will be returned. For single provider you can either pass a single
196-
string, or a list of one string. For `None` (the default value) entries for
197-
all providers will be looked up. Invalid names will be ignored, however if
198-
all are invalid, then no filtering will be done. You can look up values
199-
through [`providers`] [simplejustwatchapi.justwatch.providers] function.
231+
(e.g, `nfx` for "Netflix"), only entries which are available for given
232+
providers will be returned.
233+
234+
For single provider you can either pass a single string, or a list of one
235+
string. For `None` (the default value) entries for all providers will be
236+
looked up.
237+
238+
Invalid names will be ignored, however if all are invalid, then no filtering
239+
will be done. You can look up values through [`providers`]
240+
[simplejustwatchapi.justwatch.providers] function.
200241
201242
Returns:
202243
(list[MediaEntry]): List of tuples with details of popular titles.
@@ -243,22 +284,34 @@ def details(
243284
244285
Args:
245286
node_id (str): ID of an entry to look up.
246-
country (str): 2-letter country code for which offers are selected. It should be
247-
uppercase, however it will be normalized to uppercase automatically. It
248-
**must** be 2-letters long. It seems to be **ISO 3166-1 alpha-2** code,
287+
288+
country (str): 2-letter country code for which offers are selected.
289+
290+
It should be uppercase, however it will be normalized to uppercase
291+
automatically.
292+
293+
It **must** be 2-letters long and seems to be **ISO 3166-1 alpha-2** code,
249294
however the API doesn't specify exact standard. If unexpected code is used,
250295
then [`JustWatchApiError`][simplejustwatchapi.exceptions.JustWatchApiError]
251296
exception is raised, as the API will respond with internal error.
297+
252298
language (str): Code for language in response (e.g., description, title).
299+
253300
In most basic form it's 2 lowercase letters (e.g., `en`, `de`).
254301
It can also contain alphanumeric (in uppercase) suffix after `-` symbol,
255302
most likely used for regional variants (e.g., `en-US`, `de-CH1901`).
303+
256304
It looks like a variant of **IETF BCP 47**, however the suffix can contain
257-
only uppercase letters and numbers. Its value isn't normalized and **must**
258-
be provided in expected format, including letter case.
305+
only uppercase letters and numbers.
306+
307+
Its value isn't normalized and **must** be provided in expected format,
308+
including letter case.
309+
259310
best_only (bool): Return only best offers if `True`, return all offers if
260-
`False`. If service offers the same title in 4K, HD, and SD, then
261-
`best_only = True` returns only 4K, `best_only = False` returns all three.
311+
`False`.
312+
313+
If service offers the same title in 4K, HD, and SD, then `best_only = True`
314+
returns only 4K, `best_only = False` returns all three.
262315
263316
Returns:
264317
(MediaEntry): Tuple with data about requested entry.
@@ -284,22 +337,34 @@ def seasons(
284337
285338
Args:
286339
show_id (str): ID of a show to look up seasons for.
287-
country (str): 2-letter country code for which offers are selected. It should be
288-
uppercase, however it will be normalized to uppercase automatically. It
289-
**must** be 2-letters long. It seems to be **ISO 3166-1 alpha-2** code,
340+
341+
country (str): 2-letter country code for which offers are selected.
342+
343+
It should be uppercase, however it will be normalized to uppercase
344+
automatically.
345+
346+
It **must** be 2-letters long and seems to be **ISO 3166-1 alpha-2** code,
290347
however the API doesn't specify exact standard. If unexpected code is used,
291348
then [`JustWatchApiError`][simplejustwatchapi.exceptions.JustWatchApiError]
292349
exception is raised, as the API will respond with internal error.
350+
293351
language (str): Code for language in response (e.g., description, title).
352+
294353
In most basic form it's 2 lowercase letters (e.g., `en`, `de`).
295354
It can also contain alphanumeric (in uppercase) suffix after `-` symbol,
296355
most likely used for regional variants (e.g., `en-US`, `de-CH1901`).
356+
297357
It looks like a variant of **IETF BCP 47**, however the suffix can contain
298-
only uppercase letters and numbers. Its value isn't normalized and **must**
299-
be provided in expected format, including letter case.
358+
only uppercase letters and numbers.
359+
360+
Its value isn't normalized and **must** be provided in expected format,
361+
including letter case.
362+
300363
best_only (bool): Return only best offers if `True`, return all offers if
301-
`False`. If service offers the same title in 4K, HD, and SD, then
302-
`best_only = True` returns only 4K, `best_only = False` returns all three.
364+
`False`.
365+
366+
If service offers the same title in 4K, HD, and SD, then `best_only = True`
367+
returns only 4K, `best_only = False` returns all three.
303368
304369
Returns:
305370
(list[MediaEntry]): List of tuples with seasons data about requested show.
@@ -326,22 +391,34 @@ def episodes(
326391
327392
Args:
328393
season_id (str): ID of season to look up episodes for.
329-
country (str): 2-letter country code for which offers are selected. It should be
330-
uppercase, however it will be normalized to uppercase automatically. It
331-
**must** be 2-letters long. It seems to be **ISO 3166-1 alpha-2** code,
394+
395+
country (str): 2-letter country code for which offers are selected.
396+
397+
It should be uppercase, however it will be normalized to uppercase
398+
automatically.
399+
400+
It **must** be 2-letters long and seems to be **ISO 3166-1 alpha-2** code,
332401
however the API doesn't specify exact standard. If unexpected code is used,
333402
then [`JustWatchApiError`][simplejustwatchapi.exceptions.JustWatchApiError]
334403
exception is raised, as the API will respond with internal error.
404+
335405
language (str): Code for language in response (e.g., description, title).
406+
336407
In most basic form it's 2 lowercase letters (e.g., `en`, `de`).
337408
It can also contain alphanumeric (in uppercase) suffix after `-` symbol,
338409
most likely used for regional variants (e.g., `en-US`, `de-CH1901`).
410+
339411
It looks like a variant of **IETF BCP 47**, however the suffix can contain
340-
only uppercase letters and numbers. Its value isn't normalized and **must**
341-
be provided in expected format, including letter case.
412+
only uppercase letters and numbers.
413+
414+
Its value isn't normalized and **must** be provided in expected format,
415+
including letter case.
416+
342417
best_only (bool): Return only best offers if `True`, return all offers if
343-
`False`. If service offers the same title in 4K, HD, and SD, then
344-
`best_only = True` returns only 4K, `best_only = False` returns all three.
418+
`False`.
419+
420+
If service offers the same title in 4K, HD, and SD, then `best_only = True`
421+
returns only 4K, `best_only = False` returns all three.
345422
346423
Returns:
347424
(list[Episode]): List of tuples with episode data about requested season.
@@ -386,23 +463,36 @@ def offers_for_countries(
386463
387464
Args:
388465
node_id (str): ID of entry to look up offers for.
466+
389467
countries (set[str]): 2-letter country codes for which offers are selected.
468+
390469
They should be uppercase, however tthey will be normalized to uppercase
391-
automatically. They **must** be 2-letters long. They seems to be
392-
**ISO 3166-1 alpha-2** code, however the API doesn't specify exact standard.
470+
automatically.
471+
472+
They **must** be 2-letters long and seem to be **ISO 3166-1 alpha-2** code,
473+
however the API doesn't specify exact standard.
474+
393475
If unexpected code is used, then [`JustWatchApiError`]
394476
[simplejustwatchapi.exceptions.JustWatchApiError] exception is raised,
395477
as the API will respond with internal error.
478+
396479
language (str): Code for language in response (e.g., description, title).
480+
397481
In most basic form it's 2 lowercase letters (e.g., `en`, `de`).
398482
It can also contain alphanumeric (in uppercase) suffix after `-` symbol,
399483
most likely used for regional variants (e.g., `en-US`, `de-CH1901`).
484+
400485
It looks like a variant of **IETF BCP 47**, however the suffix can contain
401-
only uppercase letters and numbers. Its value isn't normalized and **must**
402-
be provided in expected format, including letter case.
486+
only uppercase letters and numbers.
487+
488+
Its value isn't normalized and **must** be provided in expected format,
489+
including letter case.
490+
403491
best_only (bool): Return only best offers if `True`, return all offers if
404-
`False`. If service offers the same title in 4K, HD, and SD, then
405-
`best_only = True` returns only 4K, `best_only = False` returns all three.
492+
`False`.
493+
494+
If service offers the same title in 4K, HD, and SD, then `best_only = True`
495+
returns only 4K, `best_only = False` returns all three.
406496
407497
Returns:
408498
(dict[str, list[Offer]]): Keys match values in `countries` and values are all
@@ -427,19 +517,23 @@ def providers(country: str = "US") -> list[OfferPackage]:
427517
Look up all providers for the given country.
428518
429519
Args:
430-
country (str): 2-letter country code for which offers are selected. It should be
431-
uppercase, however it will be normalized to uppercase automatically. It
432-
**must** be 2-letters long. It seems to be **ISO 3166-1 alpha-2** code,
520+
country (str): 2-letter country code for which offers are selected.
521+
522+
It should be uppercase, however it will be normalized to uppercase
523+
automatically.
524+
525+
It **must** be 2-letters long and seems to be **ISO 3166-1 alpha-2** code,
433526
however the API doesn't specify exact standard. If unexpected code is used,
434527
then [`JustWatchApiError`][simplejustwatchapi.exceptions.JustWatchApiError]
435528
exception is raised, as the API will respond with internal error.
436529
437530
Returns:
438-
(list[OfferPackage]): List of all found providers. [`OfferPackage`]
439-
[simplejustwatchapi.tuples.OfferPackage] tuple matches values in [`Offer`]
440-
[simplejustwatchapi.tuples.Offer] (and thus in [`MediaEntry`]
441-
[simplejustwatchapi.tuples.MediaEntry]), but the data structure is the same,
442-
so the same tuple is reused.
531+
(list[OfferPackage]): List of all found providers.
532+
533+
[`OfferPackage`][simplejustwatchapi.tuples.OfferPackage] tuple matches
534+
values in [`Offer`][simplejustwatchapi.tuples.Offer] (and thus in
535+
[`MediaEntry`][simplejustwatchapi.tuples.MediaEntry]), but the data
536+
structure is the same, so the same tuple is reused.
443537
444538
Raises:
445539
exceptions.JustWatchApiError: JSON response from API has internal errors.

0 commit comments

Comments
 (0)