MCPcopy Index your code
hub / github.com/python/cpython / testzip

Method testzip

Lib/zipfile/__init__.py:1626–1640  ·  view source on GitHub ↗

Read all the files and check the CRC. Return None if all files could be read successfully, or the name of the offending file otherwise.

(self)

Source from the content-addressed store, hash-verified

1624 file=file)
1625
1626 def testzip(self):
1627 """Read all the files and check the CRC.
1628
1629 Return None if all files could be read successfully, or the name
1630 of the offending file otherwise."""
1631 chunk_size = 2 ** 20
1632 for zinfo in self.filelist:
1633 try:
1634 # Read by chunks, to avoid an OverflowError or a
1635 # MemoryError with very large embedded files.
1636 with self.open(zinfo.filename, "r") as f:
1637 while f.read(chunk_size): # Check CRC-32
1638 pass
1639 except BadZipFile:
1640 return zinfo.filename
1641
1642 def getinfo(self, name):
1643 """Return the instance of ZipInfo given 'name'."""

Callers 6

zipTestMethod · 0.80
zip_testMethod · 0.80
zip_testMethod · 0.80
mainFunction · 0.80

Calls 2

openMethod · 0.95
readMethod · 0.45

Tested by 5

zipTestMethod · 0.64
zip_testMethod · 0.64
zip_testMethod · 0.64