Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f8ddb90

Browse files
stainless-app[bot]stainless-bot
authored andcommittedJan 15, 2025
chore(internal): bump pyright dependency (#822)
1 parent 758d324 commit f8ddb90

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
@@ -91,7 +91,7 @@ pydantic-core==2.27.1
9191
# via pydantic
9292
pygments==2.18.0
9393
# via rich
94-
pyright==1.1.391
94+
pyright==1.1.392.post0
9595
pytest==8.3.3
9696
# via pytest-asyncio
9797
pytest-asyncio==0.24.0

‎src/anthropic/_legacy_response.py

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

297-
if inspect.isclass(origin) and issubclass(origin, httpx.Response):
297+
if inspect.isclass(
298+
origin # pyright: ignore[reportUnknownArgumentType]
299+
) and issubclass(origin, httpx.Response):
298300
# Because of the invariance of our ResponseT TypeVar, users can subclass httpx.Response
299301
# and pass that class to our request functions. We cannot change the variance to be either
300302
# covariant or contravariant as that makes our usage of ResponseT illegal. We could construct
@@ -304,7 +306,13 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
304306
raise ValueError(f"Subclasses of httpx.Response cannot be passed to `cast_to`")
305307
return cast(R, response)
306308

307-
if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel):
309+
if (
310+
inspect.isclass(
311+
origin # pyright: ignore[reportUnknownArgumentType]
312+
)
313+
and not issubclass(origin, BaseModel)
314+
and issubclass(origin, pydantic.BaseModel)
315+
):
308316
raise TypeError("Pydantic models must subclass our base model type, e.g. `from anthropic import BaseModel`")
309317

310318
if (

‎src/anthropic/_response.py

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

239-
if inspect.isclass(origin) and not issubclass(origin, BaseModel) and issubclass(origin, pydantic.BaseModel):
239+
if (
240+
inspect.isclass(
241+
origin # pyright: ignore[reportUnknownArgumentType]
242+
)
243+
and not issubclass(origin, BaseModel)
244+
and issubclass(origin, pydantic.BaseModel)
245+
):
240246
raise TypeError("Pydantic models must subclass our base model type, e.g. `from anthropic import BaseModel`")
241247

242248
if (

0 commit comments

Comments
 (0)
Please sign in to comment.