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

Method close

gridfs/asynchronous/grid_file.py:1319–1327  ·  view source on GitHub ↗

Flush the file and close it. A closed file cannot be written any more. Calling :meth:`close` more than once is allowed.

(self)

Source from the content-addressed store, hash-verified

1317 raise FileExists("file with _id %r already exists" % file_id)
1318
1319 async def close(self) -> None:
1320 """Flush the file and close it.
1321
1322 A closed file cannot be written any more. Calling
1323 :meth:`close` more than once is allowed.
1324 """
1325 if not self._closed:
1326 await self._flush()
1327 object.__setattr__(self, "_closed", True)
1328
1329 def read(self, size: int = -1) -> NoReturn:
1330 raise io.UnsupportedOperation("read")

Callers 15

__aexit__Method · 0.95
test_basicMethod · 0.95
test_md5Method · 0.95
test_write_file_likeMethod · 0.95
test_write_linesMethod · 0.95
test_closeMethod · 0.95
test_closedMethod · 0.95

Calls 2

_flushMethod · 0.95
__setattr__Method · 0.45

Tested by 15

test_basicMethod · 0.76
test_md5Method · 0.76
test_write_file_likeMethod · 0.76
test_write_linesMethod · 0.76
test_closeMethod · 0.76
test_closedMethod · 0.76
test_multi_chunk_fileMethod · 0.76