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

Function collect

tests/utils.py:279–287  ·  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: Anthropic)

Source from the content-addressed store, hash-verified

277
278
279def collect(client: Anthropic) -> None:
280 """Collects garbage and checks that this closes what was dropped, so that it means something if the rest is open."""
281 dropped = Body()
282 stream = requester(client, dropped)()
283 next(stream)
284 in_a_cycle(stream)
285 del stream
286 gc.collect()
287 assert dropped.closes == 1
288
289
290async def async_collect(client: AsyncAnthropic) -> None:

Calls 3

requesterFunction · 0.85
in_a_cycleFunction · 0.85
BodyClass · 0.70