MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / async_collect

Function async_collect

tests/utils.py:308–317  ·  view source on GitHub ↗

Collects garbage and checks that this closes what was dropped, so that it means something if the rest is open.

(client: AsyncAnthropic)

Source from the content-addressed store, hash-verified

306
307
308async def async_collect(client: AsyncAnthropic) -> None:
309 """Collects garbage and checks that this closes what was dropped, so that it means something if the rest is open."""
310 dropped = Body()
311 stream = await async_requester(client, dropped)()
312 await anext(stream)
313 in_a_cycle(stream)
314 del stream
315 gc.collect()
316 await dropped.wait_closed()
317 assert dropped.closes == 1
318
319
320@dataclass(frozen=True)

Calls 4

wait_closedMethod · 0.95
async_requesterFunction · 0.85
in_a_cycleFunction · 0.85
BodyClass · 0.70