chore(internal): codegen related update

This commit is contained in:
stainless-app[bot] 2025-11-28 03:09:11 +00:00
parent 875138a43a
commit ab5c4936b8
4 changed files with 20 additions and 16 deletions

View file

@ -46,7 +46,7 @@ managed = true
# version pins are in requirements-dev.lock
dev-dependencies = [
"pyright==1.1.399",
"mypy",
"mypy==1.17",
"respx",
"pytest",
"pytest-asyncio",

View file

@ -72,7 +72,7 @@ mdurl==0.1.2
multidict==6.4.4
# via aiohttp
# via yarl
mypy==1.14.1
mypy==1.17.0
mypy-extensions==1.0.0
# via mypy
nodeenv==1.8.0
@ -81,6 +81,8 @@ nox==2023.4.22
packaging==23.2
# via nox
# via pytest
pathspec==0.12.1
# via mypy
platformdirs==3.11.0
# via virtualenv
pluggy==1.5.0

View file

@ -55,21 +55,21 @@ multidict==6.4.4
propcache==0.3.1
# via aiohttp
# via yarl
pydantic==2.11.9
pydantic==2.12.5
# via opencode-ai
pydantic-core==2.33.2
pydantic-core==2.41.5
# via pydantic
sniffio==1.3.0
# via anyio
# via opencode-ai
typing-extensions==4.12.2
typing-extensions==4.15.0
# via anyio
# via multidict
# via opencode-ai
# via pydantic
# via pydantic-core
# via typing-inspection
typing-inspection==0.4.1
typing-inspection==0.4.2
# via pydantic
yarl==1.20.0
# via aiohttp

View file

@ -54,11 +54,12 @@ class Stream(Generic[_T]):
process_data = self._client._process_response_data
iterator = self._iter_events()
for sse in iterator:
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
# As we might not fully consume the response stream, we need to close it explicitly
response.close()
try:
for sse in iterator:
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
finally:
# Ensure the response is closed even if the consumer doesn't read all data
response.close()
def __enter__(self) -> Self:
return self
@ -117,11 +118,12 @@ class AsyncStream(Generic[_T]):
process_data = self._client._process_response_data
iterator = self._iter_events()
async for sse in iterator:
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
# As we might not fully consume the response stream, we need to close it explicitly
await response.aclose()
try:
async for sse in iterator:
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
finally:
# Ensure the response is closed even if the consumer doesn't read all data
await response.aclose()
async def __aenter__(self) -> Self:
return self