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

Function collect

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

295
296
297def collect(client: Anthropic) -> None:
298 """Collects garbage and checks that this closes what was dropped, so that it means something if the rest is open."""
299 dropped = Body()
300 stream = requester(client, dropped)()
301 next(stream)
302 in_a_cycle(stream)
303 del stream
304 gc.collect()
305 assert dropped.closes == 1
306
307
308async def async_collect(client: AsyncAnthropic) -> None:

Calls 3

requesterFunction · 0.85
in_a_cycleFunction · 0.85
BodyClass · 0.70