Lines Matching refs:ZipFile

55         with zipfile.ZipFile(f, "w", compression) as zipfp:
64 with zipfile.ZipFile(f, "r", compression) as zipfp:
126 with zipfile.ZipFile(f, "r", compression) as zipfp:
152 with zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED) as zipfp:
158 with zipfile.ZipFile(TESTFN2, "r") as zipfp:
174 with zipfile.ZipFile(f, "r", compression) as zipfp:
193 with zipfile.ZipFile(f, 'w', zipfile.ZIP_STORED) as zipfp:
197 with zipfile.ZipFile(f, 'r') as zipfp:
208 with zipfile.ZipFile(f, "r") as zipfp:
228 with zipfile.ZipFile(f, "r") as zipfp:
238 with zipfile.ZipFile(f, "r") as zipfp:
248 with zipfile.ZipFile(f, "r") as zipfp:
309 with zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_DEFLATED) as zipfp:
313 with zipfile.ZipFile(TESTFN2, "r", zipfile.ZIP_DEFLATED) as zipfp:
319 with zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED) as zipfp:
322 with zipfile.ZipFile(TESTFN2, "r", zipfile.ZIP_STORED) as zipfp:
327 with zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED) as zipfp:
330 with zipfile.ZipFile(TESTFN2, "a", zipfile.ZIP_STORED) as zipfp:
338 data = 'I am not a ZipFile!'*10
342 with zipfile.ZipFile(TESTFN2, "a", zipfile.ZIP_STORED) as zipfp:
347 with zipfile.ZipFile(f, "r") as zipfp:
353 with io.BytesIO(zipfiledata) as bio, zipfile.ZipFile(bio) as zipfp:
359 with zipfile.ZipFile(bio, 'w', zipfile.ZIP_STORED) as zipfp:
362 data = b'I am not a ZipFile!'*10
367 with zipfile.ZipFile(TESTFN2) as zipfp:
373 with zipfile.ZipFile(bio, 'w', zipfile.ZIP_STORED) as zipfp:
376 data = b'I am not a ZipFile!'*1000000
381 with zipfile.ZipFile(TESTFN2, 'a') as zipfp:
388 with io.BytesIO(zipfiledata) as bio, zipfile.ZipFile(bio) as zipfp:
394 with zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED) as zipfp:
398 with zipfile.ZipFile(TESTFN2, "r") as zipfp:
399 self.assertIsInstance(zipfp, zipfile.ZipFile)
402 with zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED) as zipfp:
407 with zipfile.ZipFile(TESTFN2, "r") as zipfp:
408 self.assertIsInstance(zipfp, zipfile.ZipFile)
412 """Check that calling ZipFile.write without arcname specified
414 with zipfile.ZipFile(TESTFN2, "w") as zipfp:
423 with zipfile.ZipFile(TESTFN2, "w") as zipfp:
432 """Check that trying to call write() on a readonly ZipFile object
434 with zipfile.ZipFile(TESTFN2, mode="w") as zipfp:
437 with zipfile.ZipFile(TESTFN2, mode="r") as zipfp:
441 with zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED) as zipfp:
445 with zipfile.ZipFile(TESTFN2, "r") as zipfp:
464 with zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED) as zipfp:
468 with zipfile.ZipFile(TESTFN2, "r") as zipfp:
489 with zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED) as zipfp:
493 with zipfile.ZipFile(TESTFN2, "r") as zipfp:
547 with zipfile.ZipFile(TESTFN2, 'w', zipfile.ZIP_STORED) as zipfp:
558 with zipfile.ZipFile(TESTFN2, 'r') as zipfp:
565 with zipfile.ZipFile(TESTFN2, 'r') as zipfp:
572 with zipfile.ZipFile(TESTFN2, 'r') as zipfp:
579 with zipfile.ZipFile(TESTFN2, 'r') as zipfp:
587 zipfp = zipfile.ZipFile(TESTFN2, "w")
605 with zipfile.ZipFile(f, "r") as zipfp:
615 with zipfile.ZipFile(TESTFN2, "w") as zipfp:
621 with zipfile.ZipFile(TESTFN2, "r") as zipfp:
628 with zipfile.ZipFile(TESTFN2, "w") as zipfp:
633 with zipfile.ZipFile(TESTFN2, "r") as zipfp2:
641 with zipfile.ZipFile(TESTFN2, "w") as zipfp:
668 with zipfile.ZipFile(f, "w", compression) as zipfp:
673 with zipfile.ZipFile(f, "w", compression) as zipfp:
684 with zipfile.ZipFile(f, "w", compression, allowZip64=True) as zipfp:
690 with zipfile.ZipFile(f, "r", compression) as zipfp:
754 with zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED,
758 with zipfile.ZipFile(TESTFN2, "r", zipfile.ZIP_STORED) as zipfp:
763 # and that the resulting archive can be read properly by ZipFile
764 zipf = zipfile.ZipFile(TESTFN, mode="w", allowZip64=True)
772 zipf2 = zipfile.ZipFile(TESTFN, mode="r")
780 zipf = zipfile.ZipFile(TESTFN, mode="w", allowZip64=False)
791 zipf = zipfile.ZipFile(TESTFN, mode="a", allowZip64=False)
799 zipf = zipfile.ZipFile(TESTFN, mode="a", allowZip64=True)
808 zipf2 = zipfile.ZipFile(TESTFN, mode="r")
930 with zipfile.ZipFile(TESTFN, "w") as zf:
935 with zipfile.ZipFile(TESTFN, "r") as zf:
947 with zipfile.ZipFile(TESTFN, 'a') as zf:
954 with zipfile.ZipFile(TESTFN, 'r') as zf:
958 # This test checks that the ZipFile constructor closes the file object
960 # traceback holds a reference to the ZipFile object and, indirectly,
968 zf = zipfile.ZipFile(TESTFN)
996 with zipfile.ZipFile(fp, mode="w") as zipf:
1004 self.assertRaises(zipfile.BadZipfile, zipfile.ZipFile, fp)
1009 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1030 # ZipFile instance is finalized; this tests for regression on SF tracker
1034 # when a ZipFile instance was created for a file that did not
1040 self.assertRaises(IOError, zipfile.ZipFile, TESTFN)
1045 self.assertRaises(zipfile.BadZipfile, zipfile.ZipFile, TESTFN)
1049 self.assertRaises(zipfile.BadZipfile, zipfile.ZipFile, TESTFN)
1054 with zipfile.ZipFile(data, mode="w") as zipf:
1057 # This is correct; calling .read on a closed ZipFile should raise
1070 """Check that bad modes passed to ZipFile constructor are caught."""
1071 self.assertRaises(RuntimeError, zipfile.ZipFile, TESTFN, "q")
1074 """Check that bad modes passed to ZipFile.open are caught."""
1075 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1078 with zipfile.ZipFile(TESTFN, mode="r") as zipf:
1086 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1098 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1102 """Check that bad compression methods passed to ZipFile.open are
1104 self.assertRaises(RuntimeError, zipfile.ZipFile, TESTFN, "w", -1)
1114 with zipfile.ZipFile(io.BytesIO(data), 'r') as zipf:
1120 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1135 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1139 with zipfile.ZipFile(TESTFN, mode="r") as zipf:
1144 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1147 with zipfile.ZipFile(TESTFN, mode="r") as zipf:
1152 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1156 with zipfile.ZipFile(TESTFN, mode="r") as zipf:
1160 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1164 with zipfile.ZipFile(TESTFN, mode="r") as zipf:
1168 with zipfile.ZipFile(TESTFN, "a", zipfile.ZIP_STORED) as zipf:
1171 with zipfile.ZipFile(TESTFN, "r") as zipf:
1175 with zipfile.ZipFile(TESTFN, "w", zipfile.ZIP_STORED) as zipf:
1177 with zipfile.ZipFile(TESTFN, "a", zipfile.ZIP_STORED) as zipf:
1180 with zipfile.ZipFile(TESTFN, "r") as zipf:
1187 with zipfile.ZipFile(io.BytesIO(zipdata), mode="r") as zipf:
1202 # Using ZipFile.read()
1203 with zipfile.ZipFile(io.BytesIO(zipdata), mode="r") as zipf:
1207 with zipfile.ZipFile(io.BytesIO(zipdata), mode="r") as zipf:
1212 with zipfile.ZipFile(io.BytesIO(zipdata), mode="r") as zipf:
1232 with zipfile.ZipFile(io.BytesIO(), "w", compression) as zipf:
1248 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1251 zipf = zipfile.ZipFile(TESTFN, mode="r")
1256 with zipfile.ZipFile(TESTFN, mode="a") as zipf:
1259 zipf = zipfile.ZipFile(TESTFN, mode="r")
1270 self.assertRaises(zipfile.BadZipfile, zipfile.ZipFile, TESTFN, 'r')
1287 with zipfile.ZipFile(io.BytesIO(zipdata), 'r') as zipf:
1325 self.zip = zipfile.ZipFile(TESTFN, "r")
1328 self.zip2 = zipfile.ZipFile(TESTFN2, "r")
1372 with zipfile.ZipFile(f, "w", compression) as zipfp:
1380 with zipfile.ZipFile(f, "r", compression) as zipfp:
1399 with zipfile.ZipFile(f, "r", compression) as zipfp:
1437 with zipfile.ZipFile(f, "r", compression) as zipfp:
1469 with zipfile.ZipFile(f, "w", zipfile.ZIP_DEFLATED) as zipfp:
1474 # Verify that (when the ZipFile is in control of creating file objects)
1477 with zipfile.ZipFile(TESTFN2, mode="r") as zipf:
1487 # Verify that (when the ZipFile is in control of creating file objects)
1490 with zipfile.ZipFile(TESTFN2, mode="r") as zipf:
1500 # Verify that (when the ZipFile is in control of creating file objects)
1503 with zipfile.ZipFile(TESTFN2, mode="r") as zipf:
1517 with zipfile.ZipFile(TESTFN2, 'r') as zipf:
1533 with zipfile.ZipFile(TESTFN2, 'w', zipfile.ZIP_DEFLATED) as zipf:
1539 with zipfile.ZipFile(TESTFN2, 'r') as zipf:
1546 with zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_DEFLATED) as zipf:
1551 with zipfile.ZipFile(TESTFN2, 'r') as zipf:
1561 with zipfile.ZipFile(TESTFN2, mode="r") as zipf:
1578 with zipfile.ZipFile(findfile("zipdir.zip")) as zipf:
1593 with zipfile.ZipFile(TESTFN, "w") as zipf:
1602 with zipfile.ZipFile(TESTFN, "r") as zipf:
1617 with zipfile.ZipFile(TESTFN, "w") as zipf:
1622 with zipfile.ZipFile(TESTFN, "r") as zipf:
1652 with zipfile.ZipFile(f, "w", compression) as zipfp:
1660 with zipfile.ZipFile(f, "r") as zipfp:
1670 zipfp = zipfile.ZipFile(f, "r")
1693 with zipfile.ZipFile(f, "r") as zipfp:
1704 with zipfile.ZipFile(f, "r") as zipfp:
1715 with zipfile.ZipFile(f, "r") as zipfp:
1795 with captured_stdout() as t, zipfile.ZipFile(zip_name, 'r') as tf:
1816 with zipfile.ZipFile(TESTFN2) as zf:
1830 with zipfile.ZipFile(zip_name) as zf: