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

Function async_collect

tests/utils.py:290–299  ·  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

288
289
290async def async_collect(client: AsyncAnthropic) -> None:
291 """Collects garbage and checks that this closes what was dropped, so that it means something if the rest is open."""
292 dropped = Body()
293 stream = await async_requester(client, dropped)()
294 await anext(stream)
295 in_a_cycle(stream)
296 del stream
297 gc.collect()
298 await dropped.wait_closed()
299 assert dropped.closes == 1
300
301
302@dataclass(frozen=True)

Calls 4

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