Skip to content

Commit e5d4235

Browse files
feat(typing): Remove "libs" from pyright exclude and fix typing errors (#26423)
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
1 parent f60aa36 commit e5d4235

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

api/libs/external_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def handle_general_exception(e: Exception):
9494
got_request_exception.send(current_app, exception=e)
9595

9696
status_code = 500
97-
data = getattr(e, "data", {"message": http_status_message(status_code)})
97+
data: dict[str, Any] = getattr(e, "data", {"message": http_status_message(status_code)})
9898

9999
# 🔒 Normalize non-mapping data (e.g., if someone set e.data = Response)
100100
if not isinstance(data, dict):

api/libs/gmpy2_pkcs10aep_cipher.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
from Crypto import Random
2828
from Crypto.Signature.pss import MGF1
2929
from Crypto.Util.number import bytes_to_long, ceil_div, long_to_bytes
30-
from Crypto.Util.py3compat import _copy_bytes, bord
30+
from Crypto.Util.py3compat import bord
3131
from Crypto.Util.strxor import strxor
3232

3333

@@ -72,7 +72,7 @@ def __init__(self, key, hashAlgo, mgfunc, label, randfunc):
7272
else:
7373
self._mgf = lambda x, y: MGF1(x, y, self._hashObj)
7474

75-
self._label = _copy_bytes(None, None, label)
75+
self._label = bytes(label)
7676
self._randfunc = randfunc
7777

7878
def can_encrypt(self):
@@ -120,7 +120,7 @@ def encrypt(self, message):
120120
# Step 2b
121121
ps = b"\x00" * ps_len
122122
# Step 2c
123-
db = lHash + ps + b"\x01" + _copy_bytes(None, None, message)
123+
db = lHash + ps + b"\x01" + bytes(message)
124124
# Step 2d
125125
ros = self._randfunc(hLen)
126126
# Step 2e

api/libs/sendgrid.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def __init__(self, sendgrid_api_key: str, _from: str):
1414

1515
def send(self, mail: dict):
1616
logger.debug("Sending email with SendGrid")
17-
17+
_to = ""
1818
try:
1919
_to = mail["to"]
2020

@@ -28,7 +28,7 @@ def send(self, mail: dict):
2828
content = Content("text/html", mail["html"])
2929
sg_mail = Mail(from_email, to_email, subject, content)
3030
mail_json = sg_mail.get()
31-
response = sg.client.mail.send.post(request_body=mail_json) # ty: ignore [call-non-callable]
31+
response = sg.client.mail.send.post(request_body=mail_json) # type: ignore
3232
logger.debug(response.status_code)
3333
logger.debug(response.body)
3434
logger.debug(response.headers)

api/pyrightconfig.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
"migrations/",
77
"core/rag",
88
"extensions",
9-
"libs",
109
"controllers/console/datasets",
1110
"core/ops",
1211
"core/model_runtime",

0 commit comments

Comments
 (0)