Skip to content

Commit 7757d13

Browse files
committed
chore: remove more lints from ignores
1 parent c4a1544 commit 7757d13

File tree

7 files changed

+27
-23
lines changed

7 files changed

+27
-23
lines changed

src/auth/pyproject.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ select = [
6666
"I",
6767
"ANN2"
6868
]
69-
ignore = ["F403", "E712", "E501", "E402", "E722", "E731", "UP006", "UP035"]
70-
# isort.required-imports = ["from __future__ import annotations"]
69+
ignore = ["F403", "E501", "E402", "UP006", "UP035"]
7170

7271
[tool.ruff.lint.pyupgrade]
7372
# Preserve types, even if a file imports `from __future__ import annotations`.

src/auth/src/supabase_auth/_async/gotrue_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1274,7 +1274,7 @@ def __del__(self) -> None:
12741274
try:
12751275
# Try to cancel the timer
12761276
self._refresh_token_timer.cancel()
1277-
except:
1277+
except Exception:
12781278
# Ignore errors if event loop is closed or selector is not registered
12791279
pass
12801280
finally:

src/auth/src/supabase_auth/_sync/gotrue_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@ def __del__(self) -> None:
12641264
try:
12651265
# Try to cancel the timer
12661266
self._refresh_token_timer.cancel()
1267-
except:
1267+
except Exception:
12681268
# Ignore errors if event loop is closed or selector is not registered
12691269
pass
12701270
finally:

src/auth/src/supabase_auth/helpers.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from urllib.parse import urlparse
1414

1515
from httpx import HTTPStatusError, Response
16-
from pydantic import BaseModel, TypeAdapter
16+
from pydantic import BaseModel, TypeAdapter, ValidationError
1717

1818
from .constants import (
1919
API_VERSION_HEADER_NAME,
@@ -80,7 +80,7 @@ def parse_auth_response(response: Response) -> AuthResponse:
8080
try:
8181
session = model_validate(Session, response.content)
8282
user = session.user
83-
except:
83+
except ValidationError:
8484
session = None
8585
user = model_validate(User, response.content)
8686
return AuthResponse(user=user, session=session)
@@ -125,9 +125,10 @@ def parse_jwks(response: Response) -> JWKSet:
125125

126126
def get_error_message(error: Any) -> str:
127127
props = ["msg", "message", "error_description", "error"]
128-
filter = lambda prop: (
129-
prop in error if isinstance(error, dict) else hasattr(error, prop)
130-
)
128+
129+
def filter(prop) -> bool:
130+
return prop in error if isinstance(error, dict) else hasattr(error, prop)
131+
131132
return next((error[prop] for prop in props if filter(prop)), str(error))
132133

133134

src/auth/tests/_async/test_gotrue.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ async def test_sign_in_with_otp() -> None:
516516
assert args[0] == "POST"
517517
assert args[1] == "otp"
518518
assert kwargs["body"]["email"] == email
519-
assert kwargs["body"]["create_user"] == True
519+
assert kwargs["body"]["create_user"]
520520
assert kwargs["body"]["data"] == {"custom": "data"}
521521
assert (
522522
kwargs["body"]["gotrue_meta_security"]["captcha_token"]
@@ -552,7 +552,7 @@ async def test_sign_in_with_otp() -> None:
552552
assert args[0] == "POST"
553553
assert args[1] == "otp"
554554
assert kwargs["body"]["phone"] == phone
555-
assert kwargs["body"]["create_user"] == True
555+
assert kwargs["body"]["create_user"]
556556
assert kwargs["body"]["data"] == {"custom": "data"}
557557
assert kwargs["body"]["channel"] == "whatsapp"
558558
assert (

src/auth/tests/_sync/test_gotrue.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ def test_sign_in_with_otp() -> None:
514514
assert args[0] == "POST"
515515
assert args[1] == "otp"
516516
assert kwargs["body"]["email"] == email
517-
assert kwargs["body"]["create_user"] == True
517+
assert kwargs["body"]["create_user"]
518518
assert kwargs["body"]["data"] == {"custom": "data"}
519519
assert (
520520
kwargs["body"]["gotrue_meta_security"]["captcha_token"]
@@ -550,7 +550,7 @@ def test_sign_in_with_otp() -> None:
550550
assert args[0] == "POST"
551551
assert args[1] == "otp"
552552
assert kwargs["body"]["phone"] == phone
553-
assert kwargs["body"]["create_user"] == True
553+
assert kwargs["body"]["create_user"]
554554
assert kwargs["body"]["data"] == {"custom": "data"}
555555
assert kwargs["body"]["channel"] == "whatsapp"
556556
assert (

src/auth/tests/_sync/test_gotrue_admin_api.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -142,23 +142,27 @@ def test_modify_confirm_email_using_update_user_by_id() -> None:
142142

143143
def test_invalid_credential_sign_in_with_phone() -> None:
144144
try:
145-
client_api_auto_confirm_off_signups_enabled_client().sign_in_with_password(
146-
{
147-
"phone": "+123456789",
148-
"password": "strong_pwd",
149-
}
145+
(
146+
client_api_auto_confirm_off_signups_enabled_client().sign_in_with_password(
147+
{
148+
"phone": "+123456789",
149+
"password": "strong_pwd",
150+
}
151+
)
150152
)
151153
except AuthApiError as e:
152154
assert e.to_dict()
153155

154156

155157
def test_invalid_credential_sign_in_with_email() -> None:
156158
try:
157-
client_api_auto_confirm_off_signups_enabled_client().sign_in_with_password(
158-
{
159-
"email": "[email protected]",
160-
"password": "strong_pwd",
161-
}
159+
(
160+
client_api_auto_confirm_off_signups_enabled_client().sign_in_with_password(
161+
{
162+
"email": "[email protected]",
163+
"password": "strong_pwd",
164+
}
165+
)
162166
)
163167
except AuthApiError as e:
164168
assert e.to_dict()

0 commit comments

Comments
 (0)