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