Skip to content

Commit 2c73a8b

Browse files
chore(internal): bump pyright dependency (#2021)
1 parent 21ff2e6 commit 2c73a8b

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

Diff for: requirements-dev.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ pydantic-core==2.27.1
6868
# via pydantic
6969
pygments==2.18.0
7070
# via rich
71-
pyright==1.1.391
71+
pyright==1.1.392.post0
7272
pytest==8.3.3
7373
# via pytest-asyncio
7474
pytest-asyncio==0.24.0

Diff for: src/openai/_legacy_response.py

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

269-
if inspect.isclass(origin) and issubclass(origin, httpx.Response):
269+
if inspect.isclass(
270+
origin # pyright: ignore[reportUnknownArgumentType]
271+
) and issubclass(origin, httpx.Response):
270272
# Because of the invariance of our ResponseT TypeVar, users can subclass httpx.Response
271273
# and pass that class to our request functions. We cannot change the variance to be either
272274
# covariant or contravariant as that makes our usage of ResponseT illegal. We could construct
@@ -276,7 +278,13 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
276278
raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`")
277279
return cast(R, response)
278280

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

282290
if (

Diff for: 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)