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

Method read

Lib/_pyio.py:911–930  ·  view source on GitHub ↗
(self, size=-1)

Source from the content-addressed store, hash-verified

909 super().close()
910
911 def read(self, size=-1):
912 if self.closed:
913 raise ValueError("read from closed file")
914 if size is None:
915 size = -1
916 else:
917 try:
918 size_index = size.__index__
919 except AttributeError:
920 raise TypeError(f"{size!r} is not an integer")
921 else:
922 size = size_index()
923 if size < 0:
924 size = len(self._buffer)
925 if len(self._buffer) <= self._pos:
926 return b""
927 newpos = min(len(self._buffer), self._pos + size)
928 b = self._buffer[self._pos : newpos]
929 self._pos = newpos
930 return bytes(b)
931
932 def read1(self, size=-1):
933 """This is the same as read.

Callers 15

_genopsFunction · 0.95
read1Method · 0.95
_dump_messageMethod · 0.95
_install_messageMethod · 0.95
dumpsMethod · 0.95
dumpsMethod · 0.95
test_xml_c14n2Method · 0.95

Calls 2

lenFunction · 0.85
minFunction · 0.85

Tested by 15

dumpsMethod · 0.76
dumpsMethod · 0.76
test_xml_c14n2Method · 0.76
test_fileobjMethod · 0.76
test_from_fileMethod · 0.76