Deinitialize the pool upon exiting the context manager. Raises: RuntimeError: If the context manager is not active.
(
self,
exc_type: type[BaseException] | None,
exc_value: BaseException | None,
exc_traceback: TracebackType | None,
)
| 128 | return self |
| 129 | |
| 130 | async def __aexit__( |
| 131 | self, |
| 132 | exc_type: type[BaseException] | None, |
| 133 | exc_value: BaseException | None, |
| 134 | exc_traceback: TracebackType | None, |
| 135 | ) -> None: |
| 136 | """Deinitialize the pool upon exiting the context manager. |
| 137 | |
| 138 | Raises: |
| 139 | RuntimeError: If the context manager is not active. |
| 140 | """ |
| 141 | if not self._active: |
| 142 | raise RuntimeError(f'The {self.__class__.__name__} is not active.') |
| 143 | |
| 144 | await self._state.teardown() |
| 145 | |
| 146 | self._active = False |
| 147 | |
| 148 | @overload |
| 149 | def get_state(self, *, as_dict: Literal[True]) -> dict: ... |