Flush the file and close it. A closed file cannot be written any more. Calling :meth:`close` more than once is allowed.
(self)
| 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") |