From 4b8537e9b5e53909daf83ea07e529adf035a7e4b Mon Sep 17 00:00:00 2001 From: moonlightnexus Date: Thu, 18 Apr 2024 20:04:32 +0530 Subject: [PATCH 1/2] Update trustauthx to version 0.8.1 - Update setup.py with new version number - In authlite.py: - Add type hints for function return types - Change type of function --- setup.py | 2 +- trustauthx/authlite.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index 139c6e4..52a48a2 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ setup( name="trustauthx", - version="0.7.3", + version="0.8.1", description="Official connector SDK for TrustAuthx", long_description=long_description, long_description_content_type="text/markdown", # This is important! diff --git a/trustauthx/authlite.py b/trustauthx/authlite.py index 3252ee1..95efcaf 100644 --- a/trustauthx/authlite.py +++ b/trustauthx/authlite.py @@ -9,7 +9,7 @@ from jose import JWTError, jwt from jose.constants import ALGORITHMS from requests.exceptions import HTTPError - +from typing import Union from .scheme import * @@ -687,7 +687,7 @@ def re_auth(self, code): ) ) - def get_user(self, token, return_class=False) -> User | dict: + def get_user(self, token, return_class=False) -> Union[User, dict]: """ Validates the given authentication token and returns user data. @@ -919,12 +919,12 @@ def _re_init_roles(self) -> _Roles: def attach_role( self, uid: str, - rol_ids: str | list, + rol_ids: Union[str, list], signoff_session_and_assign=False, refresh_token=None, access_token=None, return_class: bool = False, - ) -> dict | SignOffSessionReplace: + ) -> Union[dict, SignOffSessionReplace]: """ Attaches a role to a user. @@ -984,12 +984,12 @@ def attach_role( def remove_role( self, uid: str, - rol_ids: str | list, + rol_ids: Union[str, list], signoff_session_and_assign=False, refresh_token=None, access_token=None, return_class: bool = False, - ) -> dict | SignOffSessionReplace: + ) -> Union[dict, SignOffSessionReplace]: """ Removes a role from a user. @@ -1049,13 +1049,13 @@ def remove_role( def update_role( self, uid: str, - rol_ids_to_add: str | list, - rol_ids_to_remove: str | list, + rol_ids_to_add: Union[str, list], + rol_ids_to_remove: Union[str, list], signoff_session_and_assign=False, refresh_token=None, access_token=None, return_class: bool = False, - ) -> dict | SignOffSessionReplace: + ) -> Union[dict, SignOffSessionReplace]: """ Updates a user's roles by adding and/or removing roles. From df7271e2281b794fc97f5f9fa55f31332a43eb08 Mon Sep 17 00:00:00 2001 From: "deepsource-autofix[bot]" <62050782+deepsource-autofix[bot]@users.noreply.github.com> Date: Thu, 18 Apr 2024 14:35:12 +0000 Subject: [PATCH 2/2] style: format code with Autopep8, Black, isort and Yapf This commit fixes the style issues introduced in 4b8537e according to the output from Autopep8, Black, isort and Yapf. Details: https://github.com/One-Click-Auth/TrustAuthx-Py-SDK/pull/57 --- trustauthx/authlite.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trustauthx/authlite.py b/trustauthx/authlite.py index 95efcaf..7397fad 100644 --- a/trustauthx/authlite.py +++ b/trustauthx/authlite.py @@ -4,12 +4,13 @@ from dataclasses import asdict from functools import wraps from lib2to3.pgen2.parse import ParseError +from typing import Union import requests from jose import JWTError, jwt from jose.constants import ALGORITHMS from requests.exceptions import HTTPError -from typing import Union + from .scheme import *