Skip to content

Commit 2afef67

Browse files
committed
chore(format): reformat
1 parent 23d0742 commit 2afef67

File tree

104 files changed

+3231
-2300
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+3231
-2300
lines changed

lumapps/api/base_client.py

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,17 @@ def __init__(
5252
proxy_info: Optional[Dict[str, Any]] = None,
5353
):
5454
"""
55-
Args:
56-
auth_info: When specified, a service account or a web auth JSON dict.
57-
api_info: When specified, a JSON dict containing the description of your
58-
api. Defaults to LumApps API.
59-
user: Email of user on behalf of whom to authenticate using domain-wide
60-
delegation.
61-
token: A bearer access token.
62-
token_getter: A bearer access token getter function.
63-
prune: Whether or not to use FILTERS to prune LumApps API responses.
64-
no_verify: Disables SSL verification.
65-
proxy_info: When specified, a JSON dict with proxy parameters.
55+
Args:
56+
auth_info: When specified, a service account or a web auth JSON dict.
57+
api_info: When specified, a JSON dict containing the description of your
58+
api. Defaults to LumApps API.
59+
user: Email of user on behalf of whom to authenticate using domain-wide
60+
delegation.
61+
token: A bearer access token.
62+
token_getter: A bearer access token getter function.
63+
prune: Whether or not to use FILTERS to prune LumApps API responses.
64+
no_verify: Disables SSL verification.
65+
proxy_info: When specified, a JSON dict with proxy parameters.
6666
"""
6767
self._token_expiry = 0
6868
self.no_verify = no_verify
@@ -200,8 +200,7 @@ def _check_access_token(self):
200200
self.token, self._token_expiry = self.token_getter()
201201

202202
def _prune(self, name_parts, content):
203-
"""Prune the api response.
204-
"""
203+
"""Prune the api response."""
205204
if not self.prune:
206205
return content
207206
for ep_filter in FILTERS:
@@ -221,7 +220,7 @@ def _prune(self, name_parts, content):
221220
return content
222221

223222
def get_new_client_as_using_dwd(self, user_email: str) -> "BaseClient":
224-
""" Get a new BaseClient using domain-wide delegation """
223+
"""Get a new BaseClient using domain-wide delegation"""
225224
return BaseClient(
226225
auth_info=self._auth_info,
227226
api_info=self.api_info,
@@ -234,15 +233,15 @@ def get_new_client_as_using_dwd(self, user_email: str) -> "BaseClient":
234233
def get_new_client_as(
235234
self, user_email: str, customer_id: Optional[str] = None
236235
) -> "BaseClient":
237-
""" Get a new BaseClient using an authorized client account by obtaining a
238-
token using the user/getToken endpoint.
236+
"""Get a new BaseClient using an authorized client account by obtaining a
237+
token using the user/getToken endpoint.
239238
240-
Args:
241-
user_email (str): User you want to authenticate on behalf of
242-
customer_id (str): Id of the LumApps customer the user belong to
239+
Args:
240+
user_email (str): User you want to authenticate on behalf of
241+
customer_id (str): Id of the LumApps customer the user belong to
243242
244-
Returns:
245-
BaseClient: A new instance of the BaseClient correctly authenticated.
243+
Returns:
244+
BaseClient: A new instance of the BaseClient correctly authenticated.
246245
"""
247246
client = BaseClient(
248247
auth_info=self._auth_info,
@@ -353,7 +352,7 @@ def _get_verb_path_params(self, name_parts, params: dict):
353352
return verb, path, params
354353

355354
def _call(self, name_parts: Sequence[str], params: dict, json=None):
356-
""" Construct the call """
355+
"""Construct the call"""
357356
verb, path, params = self._get_verb_path_params(name_parts, params)
358357
resp = self.client.request(verb, path, params=params, json=json)
359358
resp.raise_for_status()
@@ -398,21 +397,21 @@ def get_call(
398397
) -> Union[Dict[str, Any], List[Dict[str, Any]], None]:
399398
"""Generic function to call a lumapps endpoint
400399
401-
Args:
402-
*name_parts: Endpoint, eg user/get or "user", "get"
403-
**params: Parameters of the call
400+
Args:
401+
*name_parts: Endpoint, eg user/get or "user", "get"
402+
**params: Parameters of the call
404403
405-
Returns:
406-
Object or objects returned by the endpoint call.
404+
Returns:
405+
Object or objects returned by the endpoint call.
407406
408-
Example:
409-
List feedtypes in LumApps:
410-
-> GET https://.../_ah/api/lumsites/v1/feedtype/list
407+
Example:
408+
List feedtypes in LumApps:
409+
-> GET https://.../_ah/api/lumsites/v1/feedtype/list
411410
412-
With this endpoint:
411+
With this endpoint:
413412
414-
>>> feedtypes = get_call("feedtype/list")
415-
>>> print(feedtypes)
413+
>>> feedtypes = get_call("feedtype/list")
414+
>>> print(feedtypes)
416415
"""
417416
name_parts = _parse_endpoint_parts(name_parts)
418417
items: List[dict] = []
@@ -459,22 +458,22 @@ def iter_call(
459458
None,
460459
]:
461460
"""
462-
Args:
463-
*name_parts: Endpoint, eg user/get or "user", "get"
464-
**params: Parameters of the call
461+
Args:
462+
*name_parts: Endpoint, eg user/get or "user", "get"
463+
**params: Parameters of the call
465464
466-
Yields:
467-
Objects returned by the endpoint call
465+
Yields:
466+
Objects returned by the endpoint call
468467
469468
470-
Example:
471-
List feedtypes in LumApps:
472-
-> GET https://.../_ah/api/lumsites/v1/feedtype/list
469+
Example:
470+
List feedtypes in LumApps:
471+
-> GET https://.../_ah/api/lumsites/v1/feedtype/list
473472
474-
With this endpoint:
473+
With this endpoint:
475474
476-
>>> feedtypes = iter_call("feedtype/list")
477-
>>> for feedtype in feedtypes: print(feedtype)
475+
>>> feedtypes = iter_call("feedtype/list")
476+
>>> for feedtype in feedtypes: print(feedtype)
478477
"""
479478
name_parts = _parse_endpoint_parts(name_parts)
480479
self.cursor = cursor = params.pop("cursor", None)

0 commit comments

Comments
 (0)