MCPcopy Create free account
hub / github.com/Mercury7353/PyBench / __exit__

Method __exit__

llms/api_key_pool.py:223–237  ·  view source on GitHub ↗

Put the resource back in the pool.

(self, exc_type, exc_value, exc_traceback)

Source from the content-addressed store, hash-verified

221 return self._cur_resource.client_args
222
223 def __exit__(self, exc_type, exc_value, exc_traceback) -> bool:
224 """Put the resource back in the pool."""
225
226 # TODO how to update the usage?
227 self._cur_usage = {
228 "prompt_tokens": 0,
229 "completion_tokens": 0,
230 "total_tokens": 0,
231 }
232 heappush(self.queue, self._cur_resource.update(self._cur_usage))
233 if exc_type is not None:
234 # Log the exception or handle it as needed
235 logger.error(f"Client Pool Error: {exc_type}, {exc_value}")
236 return False
237 return True
238
239
240class RandomPool(Pool):

Callers

nothing calls this directly

Calls 1

updateMethod · 0.80

Tested by

no test coverage detected