Skip to content

Commit 0410381

Browse files
committed
make black happy too
1 parent 0b2e91c commit 0410381

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

tests/test_session.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,4 @@ def test_seal_data(TEST_CONSTANTS):
318318

319319
def test_unseal_invalid_data(TEST_CONSTANTS):
320320
with pytest.raises(Exception): # Adjust exception type based on your implementation
321-
Session.unseal_data(
322-
"invalid_sealed_data", TEST_CONSTANTS["COOKIE_PASSWORD"]
323-
)
321+
Session.unseal_data("invalid_sealed_data", TEST_CONSTANTS["COOKIE_PASSWORD"])

workos/session.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
RefreshWithSessionCookieSuccessResponse,
1414
)
1515

16+
1617
class Session:
1718
def __init__(
1819
self,
1920
*,
20-
user_management: "UserManagementModule", # type: ignore
21+
user_management: "UserManagementModule", # type: ignore
2122
client_id: str,
2223
session_data: str,
2324
cookie_password: str,
@@ -85,7 +86,10 @@ def authenticate(
8586
)
8687

8788
def refresh(
88-
self, *, organization_id: Optional[str] = None, cookie_password: Optional[str] = None
89+
self,
90+
*,
91+
organization_id: Optional[str] = None,
92+
cookie_password: Optional[str] = None,
8993
) -> Union[
9094
RefreshWithSessionCookieSuccessResponse,
9195
RefreshWithSessionCookieErrorResponse,
@@ -150,10 +154,11 @@ def get_logout_url(self) -> str:
150154
f"Failed to extract session ID for logout URL: {auth_response.reason}"
151155
)
152156

153-
result = self.user_management.get_logout_url(session_id=auth_response.session_id)
157+
result = self.user_management.get_logout_url(
158+
session_id=auth_response.session_id
159+
)
154160
return str(result)
155161

156-
157162
def is_valid_jwt(self, token: str) -> bool:
158163
try:
159164
signing_key = self.jwks.get_signing_key_from_jwt(token)

workos/user_management.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1081,7 +1081,11 @@ def authenticate_with_code(
10811081
ip_address: Optional[str] = None,
10821082
user_agent: Optional[str] = None,
10831083
) -> AuthKitAuthenticationResponse:
1084-
if session is not None and session.get("seal_session") and not session.get("cookie_password"):
1084+
if (
1085+
session is not None
1086+
and session.get("seal_session")
1087+
and not session.get("cookie_password")
1088+
):
10851089
raise ValueError("cookie_password is required when sealing session")
10861090

10871091
payload: AuthenticateWithCodeParameters = {
@@ -1182,7 +1186,11 @@ def authenticate_with_refresh_token(
11821186
ip_address: Optional[str] = None,
11831187
user_agent: Optional[str] = None,
11841188
) -> RefreshTokenAuthenticationResponse:
1185-
if session is not None and session.get("seal_session") and not session.get("cookie_password"):
1189+
if (
1190+
session is not None
1191+
and session.get("seal_session")
1192+
and not session.get("cookie_password")
1193+
):
11861194
raise ValueError("cookie_password is required when sealing session")
11871195

11881196
payload: AuthenticateWithRefreshTokenParameters = {
@@ -1680,7 +1688,11 @@ async def authenticate_with_code(
16801688
ip_address: Optional[str] = None,
16811689
user_agent: Optional[str] = None,
16821690
) -> AuthKitAuthenticationResponse:
1683-
if session is not None and session.get("seal_session") and not session.get("cookie_password"):
1691+
if (
1692+
session is not None
1693+
and session.get("seal_session")
1694+
and not session.get("cookie_password")
1695+
):
16841696
raise ValueError("cookie_password is required when sealing session")
16851697

16861698
payload: AuthenticateWithCodeParameters = {
@@ -1789,7 +1801,11 @@ async def authenticate_with_refresh_token(
17891801
ip_address: Optional[str] = None,
17901802
user_agent: Optional[str] = None,
17911803
) -> RefreshTokenAuthenticationResponse:
1792-
if session is not None and session.get("seal_session") and not session.get("cookie_password"):
1804+
if (
1805+
session is not None
1806+
and session.get("seal_session")
1807+
and not session.get("cookie_password")
1808+
):
17931809
raise ValueError("cookie_password is required when sealing session")
17941810

17951811
payload: AuthenticateWithRefreshTokenParameters = {

0 commit comments

Comments
 (0)