Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions src/pardner/services/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def __init__(
:param service_name: Name of the service for which the transfer is being built.
:param client_id: Client identifier given by the OAuth provider upon registration.
:param redirect_uri: The registered callback URI.
:param supported_verticals: The `Vertical`s that can be fetched on the service.
:param client_secret: The `client_secret` paired to the `client_id`.
:param supported_verticals: The :class:`Vertical`s that can be fetched on the service.
:param client_secret: The ``client_secret`` paired to the ``client_id``.
:param state: State string used to prevent CSRF and identify flow.
:param verticals: The `Vertical`s for which the transfer service has
:param verticals: The :class:`Vertical`s for which the transfer service has
appropriate scope to fetch.
"""
self._client_secret = client_secret
Expand Down Expand Up @@ -74,7 +74,7 @@ def scope(self, new_scope: Iterable[str]) -> None:
"""
Sets the scope of the transfer service flow.
Some services have specific requirements for the format of the scope
string (e.g., scopes have to be comma separated, or `+` separated).
string (e.g., scopes have to be comma separated, or ``+`` separated).

:param new_scope: The new scopes that should be set for the transfer
service.
Expand All @@ -89,7 +89,7 @@ def verticals(self) -> set[Vertical]:
def verticals(self, verticals: Iterable[Vertical]) -> None:
"""
:raises: :class:`UnsupportedVerticalException`: if one or more of the
`verticals` are not supported by the service.
``verticals`` are not supported by the service.
"""
unsupported_verticals = [
vertical
Expand Down Expand Up @@ -156,14 +156,14 @@ def add_verticals(
"""
Adds to the verticals being requested.

:param verticals: `Vertical`s that should be added to service.
:param verticals: :class:`Vertical`s that should be added to service.
:param should_reauth: Whether or not the service should unauthorize itself to
start a new session with added scopes corresponding to `verticals`.
start a new session with added scopes corresponding to ``verticals``.

:returns: Whether add was successful without reauthorization (`True`) or not
(`False`).
:returns: Whether add was successful without reauthorization (``True``) or not
(``False``).

:raises: :class:`UnsupportedVerticalException`: if `should_reauth` is not
:raises: :class:`UnsupportedVerticalException`: if ``should_reauth`` is not
passed and the current scopes are insufficient, this exception is raised.
"""
new_verticals = set(verticals) - self.verticals
Expand Down Expand Up @@ -198,11 +198,11 @@ def fetch_token(
) -> dict[str, Any]:
"""
Once the end-user authorizes the application to access their data, the
resource server sends a request to `redirect_uri` with the authorization code as
resource server sends a request to ``redirect_uri`` with the authorization code as
a parameter. Using this authorization code, this method makes a request to the
resource server to obtain the access token.

One of either `code` or `authorization_response` must not be None.
One of either ``code`` or ``authorization_response`` must not be None.

:param code: the code obtained from parsing the callback URL which the end-user's
browser redirected to.
Expand Down Expand Up @@ -237,7 +237,7 @@ def scope_for_verticals(self, verticals: Iterable[Vertical]) -> set[str]:

:param verticals: The verticals for which scopes are being requested.

:returns: Scope names corresponding to `verticals`.
:returns: Scope names corresponding to ``verticals``.
"""
pass

Expand Down
6 changes: 3 additions & 3 deletions src/pardner/services/tumblr.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ def fetch_feed_posts(
obtained using the Tumblr API.

:param count: number of posts to request.
:param text_only: whether or not to request only text-based posts (`True`) or
not (`False).
:param text_only: whether or not to request only text-based posts (``True``) or
not (``False``).
:param request_params: any other endpoint-specific parameters to be sent
to the endpoint. Depending on the parameters passed, this could override
`count` and `text_only`.
``count`` and ``text_only``.

:returns: a list of dictionary objects with information for the posts in a feed.

Expand Down
9 changes: 6 additions & 3 deletions src/pardner/services/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ def scope_as_string(scopes: Any, delimiter: str = ' ') -> str | None:
Converts a sequence of individual scopes into a single scope string.

:param scopes: a sequence of scopes as strings or a scope string.
:param delimiter: the string used to separate individual scopes. Defaults to single space.
:param delimiter: the string used to separate individual scopes. Defaults to single
space.

:returns: a string containing all scopes.
:raises :class:ValueError: if `scopes` is neither a string nor a sequence of strings
:raises :class:ValueError: if ``scopes`` is neither a string nor a sequence of
strings.
"""
if isinstance(scopes, str) or scopes is None:
return scopes
Expand All @@ -23,7 +25,8 @@ def scope_as_set(scope: Any, delimiter: str = ' ') -> set[str]:
Splits a scope with potentially more than one scope into a set of scopes.

:param scope: a string with one or more scopes.
:param delimiter: the string used to separate individual scopes. Defaults to single space.
:param delimiter: the string used to separate individual scopes. Defaults to
single space.

:returns: a set of scopes.
"""
Expand Down