Skip to content

Commit f7e1f27

Browse files
committed
fix types in docstring return
1 parent 8f19ae1 commit f7e1f27

File tree

19 files changed

+109
-109
lines changed

19 files changed

+109
-109
lines changed

descope/authmethod/password.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def sign_up(
2626
user (dict) optional: Preserve additional user metadata in the form of
2727
{"name": "Desmond Copeland", "phone": "2125551212", "email": "[email protected]"}
2828
29-
Return value (dict):
29+
Return value (Union[dict, Awaitable[dict]]):
3030
Return dict in the format
3131
{"jwts": [], "user": "", "firstSeen": "", "error": ""}
3232
Includes all the jwts tokens (session token, refresh token), token claims, and user information
@@ -71,7 +71,7 @@ def sign_in(
7171
login_id (str): The login ID of the user being validated
7272
password (str): The password to be validated
7373
74-
Return value (dict):
74+
Return value (Union[dict, Awaitable[dict]]):
7575
Return dict in the format
7676
{"jwts": [], "user": "", "firstSeen": "", "error": ""}
7777
Includes all the jwts tokens (session token, refresh token), token claims, and user information
@@ -119,7 +119,7 @@ def send_reset(
119119
if those are the chosen reset methods. See the Magic Link and Enchanted Link sections
120120
for more details.
121121
122-
Return value (dict):
122+
Return value (Union[dict, Awaitable[dict]]):
123123
Return dict in the format
124124
{"resetMethod": "", "pendingRef": "", "linkId": "", "maskedEmail": ""}
125125
The contents will differ according to the chosen reset method. 'pendingRef'
@@ -202,7 +202,7 @@ def replace(
202202
old_password (str): The user's current active password
203203
new_password (str): The new password to use
204204
205-
Return value (dict):
205+
Return value (Union[dict, Awaitable[dict]]):
206206
Return dict in the format
207207
{"jwts": [], "user": "", "firstSeen": false, "error": ""}
208208
Includes all the jwts tokens (session token, refresh token), token claims, and user information
@@ -250,7 +250,7 @@ def get_policy(self) -> Union[dict, Awaitable[dict]]:
250250
Get a subset of the password policy defined in the Descope console and enforced
251251
by Descope. The goal is to enable client-side validations to give users a better UX
252252
253-
Return value (dict):
253+
Return value (Union[dict, Awaitable[dict]]):
254254
Return dict in the format
255255
{"minLength": 8, "lowercase": true, "uppercase": true, "number": true, "nonAlphanumeric": true}
256256
minLength - the minimum length of a password

descope/authmethod/sso.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def start(
1919
"""
2020
Start tenant sso session (saml/oidc based on tenant settings)
2121
22-
Return value (dict): the redirect url for the login page
22+
Return value (Union[dict, Awaitable[dict]]): the redirect url for the login page
2323
Return dict in the format
2424
{'url': 'http://dummy.com/login..'}
2525
"""

descope/authmethod/totp.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def sign_up(
2424
user (dict) optional: Preserve additional user metadata in the form of,
2525
{"name": "Desmond Copeland", "phone": "2125551212", "email": "[email protected]"}
2626
27-
Return value (dict):
27+
Return value (Union[dict, Awaitable[dict]]):
2828
Return dict in the format
2929
{"provisioningURL": "", "image": "", "key": ""}
3030
Includes 3 different ways to allow the user to save their credentials in
@@ -63,7 +63,7 @@ def sign_in_code(
6363
login_options (LoginOptions): Optional advanced controls over login parameters
6464
refresh_token: Optional refresh token is needed for specific login options
6565
66-
Return value (dict):
66+
Return value (Union[dict, Awaitable[dict]]):
6767
Return dict in the format
6868
{"jwts": [], "user": "", "firstSeen": "", "error": ""}
6969
Includes all the jwts tokens (session token, refresh token), token claims, and user information
@@ -107,7 +107,7 @@ def update_user(
107107
login_id (str): The login ID of the user whose information is being updated
108108
refresh_token (str): The session's refresh token (used for verification)
109109
110-
Return value (dict):
110+
Return value (Union[dict, Awaitable[dict]]):
111111
Return dict in the format
112112
{"provisioningURL": "", "image": "", "key": ""}
113113
Includes 3 different ways to allow the user to save their credentials in

descope/descope_client.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def get_matched_permissions(
125125
jwt_response (dict): The jwt_response object which includes all JWT claims information
126126
permissions (List[str]): List of permissions to validate for this jwt_response
127127
128-
Return value (List[str]): returns the list of permissions that are granted
128+
Return value (list[str]): returns the list of permissions that are granted
129129
"""
130130
return self.get_matched_tenant_permissions(jwt_response, "", permissions)
131131

@@ -177,7 +177,7 @@ def get_matched_tenant_permissions(
177177
tenant (str): TenantId
178178
permissions (List[str]): List of permissions to validate for this jwt_response
179179
180-
Return value (List[str]): returns the list of permissions that are granted
180+
Return value (list[str]): returns the list of permissions that are granted
181181
"""
182182
if not jwt_response:
183183
return []
@@ -224,7 +224,7 @@ def get_matched_roles(self, jwt_response: dict, roles: list[str]) -> list[str]:
224224
jwt_response (dict): The jwt_response object which includes all JWT claims information
225225
roles (List[str]): List of roles to validate for this jwt_response
226226
227-
Return value (List[str]): returns the list of roles that are granted
227+
Return value (list[str]): returns the list of roles that are granted
228228
"""
229229
return self.get_matched_tenant_roles(jwt_response, "", roles)
230230

@@ -274,7 +274,7 @@ def get_matched_tenant_roles(
274274
tenant (str): TenantId
275275
roles (List[str]): List of roles to validate for this jwt_response
276276
277-
Return value (List[str]): returns the list of roles that are granted
277+
Return value (list[str]): returns the list of roles that are granted
278278
"""
279279
if not jwt_response:
280280
return []
@@ -312,7 +312,7 @@ def validate_session(
312312
session_token (str): The session token to be validated
313313
audience (str|Iterable[str]|None): Optional recipients that the JWT is intended for (must be equal to the 'aud' claim on the provided token)
314314
315-
Return value (dict):
315+
Return value (Union[dict, Awaitable[dict]]):
316316
Return dict includes the session token and all JWT claims
317317
318318
Raise:
@@ -330,7 +330,7 @@ def refresh_session(
330330
refresh_token (str): The refresh token that will be used to refresh the session
331331
audience (str|Iterable[str]|None): Optional recipients that the JWT is intended for (must be equal to the 'aud' claim on the provided token)
332332
333-
Return value (dict):
333+
Return value (Union[dict, Awaitable[dict]]):
334334
Return dict includes the session token, refresh token, and all JWT claims
335335
336336
Raise:
@@ -355,7 +355,7 @@ def validate_and_refresh_session(
355355
refresh_token (str): The refresh token that will be used to refresh the session token, if needed
356356
audience (str|Iterable[str]|None): Optional recipients that the JWT is intended for (must be equal to the 'aud' claim on the provided token)
357357
358-
Return value (dict):
358+
Return value (Union[dict, Awaitable[dict]]):
359359
Return dict includes the session token, refresh token, and all JWT claims
360360
361361
Raise:
@@ -375,7 +375,7 @@ def logout(
375375
Args:
376376
refresh_token (str): The refresh token
377377
378-
Return value (httpx.Response): returns the response from the Descope server
378+
Return value (Union[httpx.Response, Awaitable[httpx.Response]]): returns the response from the Descope server
379379
380380
Raise:
381381
AuthException: Exception is raised if session is not authorized or another error occurs
@@ -401,7 +401,7 @@ def logout_all(
401401
Args:
402402
refresh_token (str): The refresh token
403403
404-
Return value (httpx.Response): returns the response from the Descope server
404+
Return value (Union[httpx.Response, Awaitable[httpx.Response]]): returns the response from the Descope server
405405
406406
Raise:
407407
AuthException: Exception is raised if session is not authorized or another error occurs
@@ -425,7 +425,7 @@ def me(self, refresh_token: str) -> Union[dict, Awaitable[dict]]:
425425
Args:
426426
refresh_token (str): The refresh token
427427
428-
Return value (dict): returns the user details from the server
428+
Return value (Union[dict, Awaitable[dict]]): returns the user details from the server
429429
(email:str, name:str, phone:str, loginIds[str], verifiedEmail:bool, verifiedPhone:bool)
430430
431431
Raise:
@@ -458,7 +458,7 @@ def my_tenants(
458458
ids (List[str]): Get the list of tenants
459459
refresh_token (str): The refresh token
460460
461-
Return value (dict): returns the tenant requested from the server
461+
Return value (Union[dict, Awaitable[dict]]): returns the tenant requested from the server
462462
(id:str, name:str, customAttributes:dict)
463463
464464
Raise:
@@ -498,7 +498,7 @@ def history(self, refresh_token: str) -> Union[list[dict], Awaitable[list[dict]]
498498
Args:
499499
refresh_token (str): The refresh token
500500
501-
Return value (List[dict]):
501+
Return value (Union[list[dict], Awaitable[list[dict]]]):
502502
Return List in the format
503503
[
504504
{
@@ -564,7 +564,7 @@ def select_tenant(
564564
refresh_token (str): The refresh token that will be used to refresh the session token, if needed
565565
tenant_id (str): The tenant id to place on JWT
566566
567-
Return value (dict):
567+
Return value (Union[dict, Awaitable[dict]]):
568568
Return dict includes the session token, refresh token, with the tenant id on the jwt
569569
570570
Raise:

descope/management/access_key.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ def create(
3737
description (str): an optional text the access key can hold.
3838
permitted_ips: (List[str]): An optional list of IP addresses or CIDR ranges that are allowed to use the access key.
3939
40-
Return value (dict):
40+
Return value (Union[dict, Awaitable[dict]]):
4141
Return dict in the format
4242
{
4343
"key": {},
@@ -78,7 +78,7 @@ def load(
7878
Args:
7979
id (str): The id of the access key to be loaded.
8080
81-
Return value (dict):
81+
Return value (Union[dict, Awaitable[dict]]):
8282
Return dict in the format
8383
{"key": {}}
8484
Containing the loaded access key information.
@@ -103,7 +103,7 @@ def search_all_access_keys(
103103
Args:
104104
tenant_ids (List[str]): Optional list of tenant IDs to filter by
105105
106-
Return value (dict):
106+
Return value (Union[dict, Awaitable[dict]]):
107107
Return dict in the format
108108
{"keys": []}
109109
"keys" contains a list of all of the found users and their information

descope/management/audit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def search(
4141
from_ts (datetime): Retrieve records newer than given time but not older than 30 days
4242
to_ts (datetime): Retrieve records older than given time
4343
44-
Return value (dict):
44+
Return value (Union[dict, Awaitable[dict]]):
4545
Return dict in the format
4646
{
4747
"audits": [

descope/management/authz.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def delete_schema(self) -> Union[None, Awaitable[None]]:
6666
def load_schema(self) -> Union[dict, Awaitable[dict]]:
6767
"""
6868
Load the schema for the project
69-
Return value (dict):
69+
Return value (Union[dict, Awaitable[dict]]):
7070
Return dict in the format of schema as above (see save_schema)
7171
Raise:
7272
AuthException: raised if load schema fails
@@ -277,7 +277,7 @@ def has_relations(
277277
"target": "the target that has the relation - usually users or other resources"
278278
}
279279
280-
Return value (List[dict]):
280+
Return value (Union[List[dict], Awaitable[List[dict]]]):
281281
Return List in the format
282282
[
283283
{
@@ -310,7 +310,7 @@ def who_can_access(
310310
relation_definition (str): the RD we are checking
311311
namespace (str): the namespace for the RD
312312
313-
Return value (List[str]): list of targets (user IDs usually that have the access)
313+
Return value (Union[List[dict], Awaitable[List[dict]]]): list of targets (user IDs usually that have the access)
314314
Raise:
315315
AuthException: raised if query fails
316316
"""
@@ -333,7 +333,7 @@ def resource_relations(
333333
Args:
334334
resource (str): the resource we are listing relations for
335335
336-
Return value (List[dict]):
336+
Return value (Union[List[dict], Awaitable[List[dict]]]):
337337
Return List of relations each in the format of a relation as documented in create_relations
338338
Raise:
339339
AuthException: raised if query fails
@@ -353,7 +353,7 @@ def targets_relations(
353353
Args:
354354
targets (List[str]): the list of targets we are returning the relations for
355355
356-
Return value (List[dict]):
356+
Return value (Union[List[dict], Awaitable[List[dict]]]):
357357
Return List of relations each in the format of a relation as documented in create_relations
358358
Raise:
359359
AuthException: raised if query fails
@@ -373,7 +373,7 @@ def what_can_target_access(
373373
Args:
374374
target (str): the target we are returning the relations for
375375
376-
Return value (List[dict]):
376+
Return value (Union[List[dict], Awaitable[List[dict]]]):
377377
Return List of relations each in the format of a relation as documented in create_relations
378378
Raise:
379379
AuthException: raised if query fails
@@ -395,7 +395,7 @@ def what_can_target_access_with_relation(
395395
relation_definition (str): the RD we are checking
396396
namespace (str): the namespace for the RD
397397
398-
Return value (List[dict]):
398+
Return value (Union[List[dict], Awaitable[List[dict]]]):
399399
Return List of relations each in the format of a relation as documented in create_relations
400400
Raise:
401401
AuthException: raised if query fails
@@ -419,7 +419,7 @@ def get_modified(
419419
Args:
420420
since (datetime): only return changes from this given datetime
421421
422-
Return value (dict):
422+
Return value (Union[dict, Awaitable[dict]]):
423423
Dict including "resources" list of strings, "targets" list of strings and "schemaChanged" bool
424424
Raise:
425425
AuthException: raised if query fails

descope/management/fga.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def check(
114114
"targetType": "the type of the target (namespace)"
115115
}
116116
117-
Return value (List[dict]):
117+
Return value (Union[List[dict], Awaitable[List[dict]]]):
118118
Return List in the format
119119
[
120120
{

descope/management/flow.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def list_flows(
1212
"""
1313
List all project flows
1414
15-
Return value (dict):
15+
Return value (Union[dict, Awaitable[dict]]):
1616
Return dict in the format
1717
{ "flows": [{"id": "", "name": "", "description": "", "disabled": False}], total: number}
1818
@@ -64,7 +64,7 @@ def export_flow(
6464
Args:
6565
flow_id (str): the flow id to export.
6666
67-
Return value (dict):
67+
Return value (Union[dict, Awaitable[dict]]):
6868
Return dict in the format
6969
{ "flow": {"id": "", "name": "", "description": "", "disabled": False, "etag": "", "dsl": {}}, screens: [{ "id": "", "inputs": [], "interactions": [] }] }
7070
@@ -100,7 +100,7 @@ def import_flow(
100100
screens (List[dict]): the flow screens to import. list of dictss in the format:
101101
{ "id": "", "inputs": [], "interactions": [] }
102102
103-
Return value (dict):
103+
Return value (Union[dict, Awaitable[dict]]):
104104
Return dict in the format
105105
{ "flow": {"id": "", "name": "", "description": "", "disabled": False, "etag": "", "dsl": {}}, screens: [{ "id": "", "inputs": [], "interactions": [] }] }
106106
@@ -127,7 +127,7 @@ def export_theme(
127127
"""
128128
Export the current project theme.
129129
130-
Return value (dict):
130+
Return value (Union[dict, Awaitable[dict]]):
131131
Return dict in the format
132132
{"id": "", "cssTemplate": {} }
133133
@@ -156,7 +156,7 @@ def import_theme(
156156
theme (Theme): the theme to import. dict in the format
157157
{"id": "", "cssTemplate": {} }
158158
159-
Return value (dict):
159+
Return value (Union[dict, Awaitable[dict]]):
160160
Return dict in the format
161161
{"id": "", "cssTemplate": {} }
162162

descope/management/group.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def load_all_groups(
1616
Args:
1717
tenant_id (str): Tenant ID to load groups from.
1818
19-
Return value (dict):
19+
Return value (Union[dict, Awaitable[dict]]):
2020
Return dict in the format
2121
[
2222
{
@@ -62,7 +62,7 @@ def load_all_groups_for_members(
6262
user_ids (List[str]): Optional List of user IDs, with the format of "U2J5ES9S8TkvCgOvcrkpzUgVTEBM" (example), which can be found on the user's JWT.
6363
login_ids (List[str]): Optional List of login IDs, how the users identify when logging in.
6464
65-
Return value (dict):
65+
Return value (Union[dict, Awaitable[dict]]):
6666
Return dict in the format
6767
[
6868
{
@@ -111,7 +111,7 @@ def load_all_group_members(
111111
tenant_id (str): Tenant ID to load groups from.
112112
group_id (str): Group ID to load members for.
113113
114-
Return value (dict):
114+
Return value (Union[dict, Awaitable[dict]]):
115115
Return dict in the format
116116
[
117117
{

0 commit comments

Comments
 (0)