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

Method read

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

Read at most size bytes, returned as bytes. Only makes one system call, so less data may be returned than requested In non-blocking mode, returns None if no data is available. Return an empty bytes object at EOF.

(self, size=None)

Source from the content-addressed store, hash-verified

1652 raise UnsupportedOperation('File not open for writing')
1653
1654 def read(self, size=None):
1655 """Read at most size bytes, returned as bytes.
1656
1657 Only makes one system call, so less data may be returned than requested
1658 In non-blocking mode, returns None if no data is available.
1659 Return an empty bytes object at EOF.
1660 """
1661 self._checkClosed()
1662 self._checkReadable()
1663 if size is None or size < 0:
1664 return self.readall()
1665 try:
1666 return os.read(self._fd, size)
1667 except BlockingIOError:
1668 return None
1669
1670 def readall(self):
1671 """Read all data from the file, returned as bytes.

Callers 10

readintoMethod · 0.95
readlineMethod · 0.45
_read_unlockedMethod · 0.45
_peek_unlockedMethod · 0.45
readMethod · 0.45
readMethod · 0.45
readallMethod · 0.45
_read_chunkMethod · 0.45
seekMethod · 0.45
readMethod · 0.45

Calls 3

_checkReadableMethod · 0.95
readallMethod · 0.95
_checkClosedMethod · 0.45

Tested by

no test coverage detected