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

Method write

tools/python-3.11.9-amd64/Lib/_pyio.py:967–984  ·  view source on GitHub ↗
(self, b)

Source from the content-addressed store, hash-verified

965 return self.read(size)
966
967 def write(self, b):
968 if self.closed:
969 raise ValueError("write to closed file")
970 if isinstance(b, str):
971 raise TypeError("can't write str to binary stream")
972 with memoryview(b) as view:
973 n = view.nbytes # Size of any bytes-like object
974 if n == 0:
975 return 0
976 pos = self._pos
977 if pos > len(self._buffer):
978 # Inserts null bytes between the current end of the file
979 # and the new write position.
980 padding = b'\x00' * (pos - len(self._buffer))
981 self._buffer += padding
982 self._buffer[pos:pos + n] = b
983 self._pos += n
984 return n
985
986 def seek(self, pos, whence=0):
987 if self.closed:

Callers 11

optimizeFunction · 0.95
get_messageMethod · 0.95
get_bytesMethod · 0.95
list_directoryMethod · 0.95
upload_fileMethod · 0.95
_recv_bytesMethod · 0.95
_get_more_dataMethod · 0.95
_recvMethod · 0.95
upload_fileMethod · 0.95
_fp_readMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected