Get a client from the pool and return it as a context manager.
(self, **kwargs)
| 211 | heapify(self.queue) |
| 212 | |
| 213 | def __enter__(self, **kwargs) -> ClientArgs: |
| 214 | """Get a client from the pool and return it as a context manager.""" |
| 215 | |
| 216 | if len(self) == 0: |
| 217 | raise APIKeyPoolEmptyError("api key pool is empty") |
| 218 | |
| 219 | self._cur_resource = heappop(self.queue) |
| 220 | |
| 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.""" |
nothing calls this directly
no test coverage detected