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

Method write

tools/python-3.11.9-amd64/Lib/gzip.py:272–294  ·  view source on GitHub ↗
(self,data)

Source from the content-addressed store, hash-verified

270 self.fileobj.write(fname + b'\000')
271
272 def write(self,data):
273 self._check_not_closed()
274 if self.mode != WRITE:
275 import errno
276 raise OSError(errno.EBADF, "write() on read-only GzipFile object")
277
278 if self.fileobj is None:
279 raise ValueError("write() on closed GzipFile object")
280
281 if isinstance(data, (bytes, bytearray)):
282 length = len(data)
283 else:
284 # accept any data that supports the buffer protocol
285 data = memoryview(data)
286 length = data.nbytes
287
288 if length > 0:
289 self.fileobj.write(self.compress.compress(data))
290 self.size += length
291 self.crc = zlib.crc32(data, self.crc)
292 self.offset += length
293
294 return length
295
296 def read(self, size=-1):
297 self._check_not_closed()

Callers 7

seekMethod · 0.95
mainFunction · 0.95
formatMethod · 0.95
write32uFunction · 0.45
_write_gzip_headerMethod · 0.45
closeMethod · 0.45
flushMethod · 0.45

Calls 2

_check_not_closedMethod · 0.80
compressMethod · 0.80

Tested by

no test coverage detected