Exit the async context manager protocol. Sets proxy mutability to False and persists any state changes. Args: exc_info: The exception info tuple.
(self, *exc_info: Any)
| 157 | return self |
| 158 | |
| 159 | async def __aexit__(self, *exc_info: Any) -> None: |
| 160 | """Exit the async context manager protocol. |
| 161 | |
| 162 | Sets proxy mutability to False and persists any state changes. |
| 163 | |
| 164 | Args: |
| 165 | exc_info: The exception info tuple. |
| 166 | """ |
| 167 | if self._self_parent_state_proxy is not None: |
| 168 | await self._self_parent_state_proxy.__aexit__(*exc_info) |
| 169 | return |
| 170 | try: |
| 171 | if self._self_mutable and self._self_actx is not None: |
| 172 | root_state = self.__wrapped__._get_root_state() |
| 173 | delta = await root_state._get_resolved_delta() |
| 174 | root_state._clean() |
| 175 | # When the frontend vars are modified emit the delta to the frontend. |
| 176 | if delta: |
| 177 | ctx = EventContext.get() |
| 178 | await ctx.emit_delta(delta) |
| 179 | finally: |
| 180 | try: |
| 181 | if self._self_mutable and self._self_actx is not None: |
| 182 | await self._self_actx.__aexit__(*exc_info) |
| 183 | finally: |
| 184 | self._self_actx = None |
| 185 | self._self_mutable = False |
| 186 | self._self_actx_lock_holder = None |
| 187 | self._self_actx_lock.release() |
| 188 | |
| 189 | def __enter__(self): |
| 190 | """Enter the regular context manager protocol. |
no test coverage detected