MCPcopy Index your code
hub / github.com/RustPython/RustPython / _flush_unlocked

Method _flush_unlocked

Lib/_pyio.py:1277–1292  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1275 self._flush_unlocked()
1276
1277 def _flush_unlocked(self):
1278 if self.closed:
1279 raise ValueError("flush on closed file")
1280 while self._write_buf:
1281 try:
1282 n = self.raw.write(self._write_buf)
1283 except BlockingIOError:
1284 raise RuntimeError("self.raw should implement RawIOBase: it "
1285 "should not raise BlockingIOError")
1286 if n is None:
1287 raise BlockingIOError(
1288 errno.EAGAIN,
1289 "write could not complete without blocking", 0)
1290 if n > len(self._write_buf) or n < 0:
1291 raise OSError("write() returned incorrect number of bytes")
1292 del self._write_buf[:n]
1293
1294 def tell(self):
1295 return _BufferedIOMixin.tell(self) + len(self._write_buf)

Callers 4

writeMethod · 0.95
truncateMethod · 0.95
flushMethod · 0.95
seekMethod · 0.95

Calls 2

lenFunction · 0.85
writeMethod · 0.45

Tested by

no test coverage detected