MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / read1

Method read1

tools/python-3.11.9-amd64/Lib/_pyio.py:1162–1173  ·  view source on GitHub ↗

Reads up to size bytes, with at most one read() system call.

(self, size=-1)

Source from the content-addressed store, hash-verified

1160 return self._read_buf[self._read_pos:]
1161
1162 def read1(self, size=-1):
1163 """Reads up to size bytes, with at most one read() system call."""
1164 # Returns up to size bytes. If at least one byte is buffered, we
1165 # only return buffered bytes. Otherwise, we do one raw read.
1166 if size < 0:
1167 size = self.buffer_size
1168 if size == 0:
1169 return b""
1170 with self._read_lock:
1171 self._peek_unlocked(1)
1172 return self._read_unlocked(
1173 min(size, len(self._read_buf) - self._read_pos))
1174
1175 # Implementing readinto() and readinto1() is not strictly necessary (we
1176 # could rely on the base class that provides an implementation in terms of

Callers

nothing calls this directly

Calls 3

_peek_unlockedMethod · 0.95
_read_unlockedMethod · 0.95
minFunction · 0.85

Tested by

no test coverage detected