MCPcopy Create free account
hub / github.com/mongodb/mongo-python-driver / close

Method close

gridfs/synchronous/grid_file.py:1307–1315  ·  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

1305 raise FileExists("file with _id %r already exists" % file_id)
1306
1307 def close(self) -> None:
1308 """Flush the file and close it.
1309
1310 A closed file cannot be written any more. Calling
1311 :meth:`close` more than once is allowed.
1312 """
1313 if not self._closed:
1314 self._flush()
1315 object.__setattr__(self, "_closed", True)
1316
1317 def read(self, size: int = -1) -> NoReturn:
1318 raise io.UnsupportedOperation("read")

Callers 15

__exit__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