MCPcopy Index your code
hub / github.com/mongodb/mongo-python-driver / __aexit__

Method __aexit__

gridfs/asynchronous/grid_file.py:1434–1447  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
1450GRIDOUT_BASE_CLASS = io.IOBase if _IS_SYNC else object # type: Any

Callers

nothing calls this directly

Calls 2

closeMethod · 0.95
__setattr__Method · 0.45

Tested by

no test coverage detected