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

Method close

Lib/gzip.py:381–397  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

379 return self.fileobj is None
380
381 def close(self):
382 fileobj = self.fileobj
383 if fileobj is None:
384 return
385 if self._buffer is None or self._buffer.closed:
386 return
387 try:
388 if self.mode == WRITE:
389 self._buffer.flush()
390 fileobj.write(self.compress.flush())
391 write32u(fileobj, self.crc)
392 # self.size may exceed 2 GiB, or even 4 GiB
393 write32u(fileobj, self.size & 0xffffffff)
394 elif self.mode == READ:
395 self._buffer.close()
396 finally:
397 self._close()
398
399 def _close(self):
400 self.fileobj = None

Callers 6

gzopenMethod · 0.95
mainFunction · 0.95
test_with_openMethod · 0.95
open_urlresourceFunction · 0.95
_closeMethod · 0.45

Calls 4

_closeMethod · 0.95
write32uFunction · 0.85
flushMethod · 0.45
writeMethod · 0.45

Tested by 2

test_with_openMethod · 0.76