Open the file in bytes mode, write to it, and close the file.
(self, data)
| 1403 | return f.read() |
| 1404 | |
| 1405 | def write_bytes(self, data): |
| 1406 | """ |
| 1407 | Open the file in bytes mode, write to it, and close the file. |
| 1408 | """ |
| 1409 | if not isinstance(data, pycompat.binary_type): |
| 1410 | raise TypeError( |
| 1411 | 'data must be %s, not %s' % |
| 1412 | (pycompat.binary_type.__name__, data.__class__.__name__)) |
| 1413 | with self.open(mode='wb') as f: |
| 1414 | return f.write(data) |
| 1415 | |
| 1416 | def write_text(self, data, encoding=None, errors=None): |
| 1417 | """ |