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

Method _read_eof

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

Source from the content-addressed store, hash-verified

596 return uncompress
597
598 def _read_eof(self):
599 # We've read to the end of the file
600 # We check that the computed CRC and size of the
601 # uncompressed data matches the stored values. Note that the size
602 # stored is the true file size mod 2**32.
603 crc32, isize = struct.unpack("<II", _read_exact(self._fp, 8))
604 if crc32 != self._crc:
605 raise BadGzipFile("CRC check failed %s != %s" % (hex(crc32),
606 hex(self._crc)))
607 elif isize != (self._stream_size & 0xffffffff):
608 raise BadGzipFile("Incorrect length of data produced")
609
610 # Gzip files can be padded with zeroes and still have archives.
611 # Consume all zero bytes and set the file position to the first
612 # non-zero byte. See http://www.gzip.org/#faq8
613 c = b"\x00"
614 while c == b"\x00":
615 c = self._fp.read(1)
616 if c:
617 self._fp.prepend(c)
618
619 def _rewind(self):
620 super()._rewind()

Callers 1

readMethod · 0.95

Calls 6

_read_exactFunction · 0.85
BadGzipFileClass · 0.85
hexFunction · 0.85
prependMethod · 0.80
unpackMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected