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

Method write

tools/python-3.11.9-amd64/Lib/zipfile.py:1163–1180  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

1161 return True
1162
1163 def write(self, data):
1164 if self.closed:
1165 raise ValueError('I/O operation on closed file.')
1166
1167 # Accept any data that supports the buffer protocol
1168 if isinstance(data, (bytes, bytearray)):
1169 nbytes = len(data)
1170 else:
1171 data = memoryview(data)
1172 nbytes = data.nbytes
1173 self._file_size += nbytes
1174
1175 self._crc = crc32(data, self._crc)
1176 if self._compressor:
1177 data = self._compressor.compress(data)
1178 self._compress_size += len(data)
1179 self._fileobj.write(data)
1180 return nbytes
1181
1182 def close(self):
1183 if self.closed:

Callers

nothing calls this directly

Calls 3

crc32Function · 0.85
compressMethod · 0.80
writeMethod · 0.45

Tested by

no test coverage detected