Fix raise exception docs

This commit is contained in:
JonnyWong16 2020-11-22 20:43:59 -08:00
parent 7f7d03236b
commit 274b05e913
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
9 changed files with 26 additions and 26 deletions

View file

@ -696,7 +696,7 @@ class Playable(object):
offset, copyts, protocol, mediaIndex, platform.
Raises:
:class:`~plexapi.exceptions.Unsupported`: When the item doesn't support fetching a stream URL.
:exc:`plexapi.exceptions.Unsupported`: When the item doesn't support fetching a stream URL.
"""
if self.TYPE not in ('movie', 'episode', 'track'):
raise Unsupported('Fetching stream URL for %s is unsupported.' % self.TYPE)

View file

@ -140,7 +140,7 @@ class PlexClient(PlexObject):
value (bool): Enable or disable proxying (optional, default True).
Raises:
:class:`~plexapi.exceptions.Unsupported`: Cannot use client proxy with unknown server.
:exc:`plexapi.exceptions.Unsupported`: Cannot use client proxy with unknown server.
"""
if server:
self._server = server
@ -183,7 +183,7 @@ class PlexClient(PlexObject):
**params (dict): Additional GET parameters to include with the command.
Raises:
:class:`~plexapi.exceptions.Unsupported`: When we detect the client doesn't support this capability.
:exc:`plexapi.exceptions.Unsupported`: When we detect the client doesn't support this capability.
"""
command = command.strip('/')
controller = command.split('/')[0]
@ -299,7 +299,7 @@ class PlexClient(PlexObject):
**params (dict): Additional GET parameters to include with the command.
Raises:
:class:`~plexapi.exceptions.Unsupported`: When no PlexServer specified in this object.
:exc:`plexapi.exceptions.Unsupported`: When no PlexServer specified in this object.
"""
if not self._server:
raise Unsupported('A server must be specified before using this command.')
@ -469,7 +469,7 @@ class PlexClient(PlexObject):
also: https://github.com/plexinc/plex-media-player/wiki/Remote-control-API#modified-commands
Raises:
:class:`~plexapi.exceptions.Unsupported`: When no PlexServer specified in this object.
:exc:`plexapi.exceptions.Unsupported`: When no PlexServer specified in this object.
"""
if not self._server:
raise Unsupported('A server must be specified before using this command.')

View file

@ -614,7 +614,7 @@ class LibrarySection(PlexObject):
**kwargs (dict): Additional kwargs to narrow down the choices.
Raises:
:class:`~plexapi.exceptions.BadRequest`: Cannot include kwarg equal to specified category.
:exc:`plexapi.exceptions.BadRequest`: Cannot include kwarg equal to specified category.
"""
# TODO: Should this be moved to base?
if category in kwargs:
@ -661,7 +661,7 @@ class LibrarySection(PlexObject):
* year: List of years to search within ([yyyy, ...]). [all]
Raises:
:class:`~plexapi.exceptions.BadRequest`: when applying unknown filter
:exc:`plexapi.exceptions.BadRequest`: when applying unknown filter
"""
# cleanup the core arguments
args = {}
@ -780,7 +780,7 @@ class LibrarySection(PlexObject):
:class:`~plexapi.sync.SyncItem`: an instance of created syncItem.
Raises:
:class:`~plexapi.exceptions.BadRequest`: when the library is not allowed to sync
:exc:`plexapi.exceptions.BadRequest`: when the library is not allowed to sync
Example:

View file

@ -578,8 +578,8 @@ class MyPlexAccount(PlexObject):
:class:`~plexapi.sync.SyncItem`: an instance of created syncItem.
Raises:
:class:`~plexapi.exceptions.BadRequest`: when client with provided clientId wasn`t found.
:class:`~plexapi.exceptions.BadRequest`: provided client doesn`t provides `sync-target`.
:exc:`plexapi.exceptions.BadRequest`: when client with provided clientId wasn`t found.
:exc:`plexapi.exceptions.BadRequest`: provided client doesn`t provides `sync-target`.
"""
if not client and not clientId:
clientId = X_PLEX_IDENTIFIER
@ -942,7 +942,7 @@ class MyPlexResource(PlexObject):
HTTP or HTTPS connection.
Raises:
:class:`~plexapi.exceptions.NotFound`: When unable to connect to any addresses for this resource.
:exc:`plexapi.exceptions.NotFound`: When unable to connect to any addresses for this resource.
"""
# Sort connections from (https, local) to (http, remote)
# Only check non-local connections unless we own the resource
@ -1049,7 +1049,7 @@ class MyPlexDevice(PlexObject):
at least one connection was successful, the PlexClient object is built and returned.
Raises:
:class:`~plexapi.exceptions.NotFound`: When unable to connect to any addresses for this device.
:exc:`plexapi.exceptions.NotFound`: When unable to connect to any addresses for this device.
"""
cls = PlexServer if 'server' in self.provides else PlexClient
listargs = [[cls, url, self.token, timeout] for url in self.connections]
@ -1066,7 +1066,7 @@ class MyPlexDevice(PlexObject):
""" Returns an instance of :class:`~plexapi.sync.SyncList` for current device.
Raises:
:class:`~plexapi.exceptions.BadRequest`: when the device doesn`t provides `sync-target`.
:exc:`plexapi.exceptions.BadRequest`: when the device doesn`t provides `sync-target`.
"""
if 'sync-target' not in self.provides:
raise BadRequest('Requested syncList for device which do not provides sync-target')

View file

@ -240,8 +240,8 @@ class Playlist(PlexPartialObject, Playable):
generated from metadata of current photo.
Raises:
:class:`~plexapi.exceptions.BadRequest`: when playlist is not allowed to sync.
:class:`~plexapi.exceptions.Unsupported`: when playlist content is unsupported.
:exc:`plexapi.exceptions.BadRequest`: when playlist is not allowed to sync.
:exc:`plexapi.exceptions.Unsupported`: when playlist content is unsupported.
Returns:
:class:`~plexapi.sync.SyncItem`: an instance of created syncItem.

View file

@ -270,7 +270,7 @@ class PlexServer(PlexObject):
name (str): Name of the client to return.
Raises:
:class:`~plexapi.exceptions.NotFound`: Unknown client name
:exc:`plexapi.exceptions.NotFound`: Unknown client name
"""
for client in self.clients():
if client and client.title == name:
@ -393,7 +393,7 @@ class PlexServer(PlexObject):
title (str): Title of the playlist to return.
Raises:
:class:`~plexapi.exceptions.NotFound`: Invalid playlist title
:exc:`plexapi.exceptions.NotFound`: Invalid playlist title
"""
return self.fetchItem('/playlists', title=title)
@ -494,8 +494,8 @@ class PlexServer(PlexObject):
Parameters:
callback (func): Callback function to call on recieved messages.
raises:
:class:`~plexapi.exception.Unsupported`: Websocket-client not installed.
Raises:
:exc:`plexapi.exception.Unsupported`: Websocket-client not installed.
"""
notifier = AlertListener(self, callback)
notifier.start()

View file

@ -201,7 +201,7 @@ class MediaSettings(object):
videoQuality (int): idx of quality of the video, one of VIDEO_QUALITY_* values defined in this module.
Raises:
:class:`~plexapi.exceptions.BadRequest`: when provided unknown video quality.
:exc:`plexapi.exceptions.BadRequest`: when provided unknown video quality.
"""
if videoQuality == VIDEO_QUALITY_ORIGINAL:
return MediaSettings('', '', '')
@ -231,7 +231,7 @@ class MediaSettings(object):
module.
Raises:
:class:`~plexapi.exceptions.BadRequest` when provided unknown video quality.
:exc:`plexapi.exceptions.BadRequest` when provided unknown video quality.
"""
if resolution in PHOTO_QUALITIES:
return MediaSettings(photoQuality=PHOTO_QUALITIES[resolution], photoResolution=resolution)

View file

@ -146,7 +146,7 @@ def searchType(libtype):
libtype (str): LibType to lookup (movie, show, season, episode, artist, album, track,
collection)
Raises:
:class:`~plexapi.exceptions.NotFound`: Unknown libtype
:exc:`plexapi.exceptions.NotFound`: Unknown libtype
"""
libtype = str(libtype)
if libtype in [str(v) for v in SEARCHTYPES.values()]:

View file

@ -515,14 +515,14 @@ class Show(Video):
def episode(self, title=None, season=None, episode=None):
""" Find a episode using a title or season and episode.
Parameters:
Parameters:
title (str): Title of the episode to return
season (int): Season number (default:None; required if title not specified).
episode (int): Episode number (default:None; required if title not specified).
Raises:
:class:`~plexapi.exceptions.BadRequest`: If season and episode is missing.
:class:`~plexapi.exceptions.NotFound`: If the episode is missing.
Raises:
:exc:`plexapi.exceptions.BadRequest`: If season and episode is missing.
:exc:`plexapi.exceptions.NotFound`: If the episode is missing.
"""
if title:
key = '/library/metadata/%s/allLeaves' % self.ratingKey