Support for the context manager protocol. Close the file if no exceptions occur and allow exceptions to propagate.
(self, exc_type: Any, exc_val: Any, exc_tb: Any)
| 1432 | return self |
| 1433 | |
| 1434 | async def __aexit__(self, exc_type: Any, exc_val: Any, exc_tb: Any) -> Any: |
| 1435 | """Support for the context manager protocol. |
| 1436 | |
| 1437 | Close the file if no exceptions occur and allow exceptions to propagate. |
| 1438 | """ |
| 1439 | if exc_type is None: |
| 1440 | # No exceptions happened. |
| 1441 | await self.close() |
| 1442 | else: |
| 1443 | # Something happened, at minimum mark as closed. |
| 1444 | object.__setattr__(self, "_closed", True) |
| 1445 | |
| 1446 | # propagate exceptions |
| 1447 | return False |
| 1448 | |
| 1449 | |
| 1450 | GRIDOUT_BASE_CLASS = io.IOBase if _IS_SYNC else object # type: Any |
nothing calls this directly
no test coverage detected