MCPcopy Index your code
hub / github.com/python/cpython / read

Method read

Lib/_pyio.py:1065–1076  ·  view source on GitHub ↗

Read size bytes. Returns exactly size bytes of data unless the underlying raw IO stream reaches EOF or if the call would block in non-blocking mode. If size is negative, read until EOF or until read() would block.

(self, size=None)

Source from the content-addressed store, hash-verified

1063 self._read_pos = 0
1064
1065 def read(self, size=None):
1066 """Read size bytes.
1067
1068 Returns exactly size bytes of data unless the underlying raw IO
1069 stream reaches EOF or if the call would block in non-blocking
1070 mode. If size is negative, read until EOF or until read() would
1071 block.
1072 """
1073 if size is not None and size < -1:
1074 raise ValueError("invalid number of bytes to read")
1075 with self._read_lock:
1076 return self._read_unlocked(size)
1077
1078 def _read_unlocked(self, n=None):
1079 nodata_val = b""

Callers 1

test_read_on_closedMethod · 0.95

Calls 1

_read_unlockedMethod · 0.95

Tested by 1

test_read_on_closedMethod · 0.76