Skip to content

Commit 0a9a0f5

Browse files
chore(internal): bump pyright dependency (#2021)
1 parent f26746c commit 0a9a0f5

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

requirements-dev.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ pygments==2.18.0
124124
# via rich
125125
pyjwt==2.8.0
126126
# via msal
127-
pyright==1.1.391
127+
pyright==1.1.392.post0
128128
pytest==8.3.3
129129
# via pytest-asyncio
130130
pytest-asyncio==0.24.0

src/openai/_legacy_response.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,9 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
269269
if origin == LegacyAPIResponse:
270270
raise RuntimeError("Unexpected state - cast_to is `APIResponse`")
271271

272-
if inspect.isclass(origin) and issubclass(origin, httpx.Response):
272+
if inspect.isclass(
273+
origin # pyright: ignore[reportUnknownArgumentType]
274+
) and issubclass(origin, httpx.Response):
273275
# Because of the invariance of our ResponseT TypeVar, users can subclass httpx.Response
274276
# and pass that class to our request functions. We cannot change the variance to be either
275277
# covariant or contravariant as that makes our usage of ResponseT illegal. We could construct
@@ -279,7 +281,13 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
279281
raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`")
280282
return cast(R, response)
281283

282-
if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel):
284+
if (
285+
inspect.isclass(
286+
origin # pyright: ignore[reportUnknownArgumentType]
287+
)
288+
and not issubclass(origin, BaseModel)
289+
and issubclass(origin, pydantic.BaseModel)
290+
):
283291
raise TypeError("Pydantic models must subclass our base model type, e.g. `from openai import BaseModel`")
284292

285293
if (

src/openai/_response.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,13 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
214214
raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`")
215215
return cast(R, response)
216216

217-
if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel):
217+
if (
218+
inspect.isclass(
219+
origin # pyright: ignore[reportUnknownArgumentType]
220+
)
221+
and not issubclass(origin, BaseModel)
222+
and issubclass(origin, pydantic.BaseModel)
223+
):
218224
raise TypeError("Pydantic models must subclass our base model type, e.g. `from openai import BaseModel`")
219225

220226
if (

0 commit comments

Comments
 (0)