Skip to content

Commit 24ccfc8

Browse files
chore(internal): bump pyright dependency (#574)
1 parent 40c663f commit 24ccfc8

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
@@ -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

src/finch/_legacy_response.py

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

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

275-
if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel):
277+
if (
278+
inspect.isclass(
279+
origin # pyright: ignore[reportUnknownArgumentType]
280+
)
281+
and not issubclass(origin, BaseModel)
282+
and issubclass(origin, pydantic.BaseModel)
283+
):
276284
raise TypeError("Pydantic models must subclass our base model type, e.g. `from finch import BaseModel`")
277285

278286
if (

src/finch/_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 finch import BaseModel`")
219225

220226
if (

0 commit comments

Comments
 (0)