• Home
  • Raw
  • Download

Lines Matching refs:zipfile

12 import zipfile
55 with zipfile.ZipFile(f, "w", compression) as zipfp:
64 with zipfile.ZipFile(f, "r", compression) as zipfp:
120 self.zip_test(f, zipfile.ZIP_STORED)
126 with zipfile.ZipFile(f, "r", compression) as zipfp:
148 self.zip_open_test(f, zipfile.ZIP_STORED)
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:
187 self.zip_random_open_test(f, zipfile.ZIP_STORED)
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:
255 self.zip_readline_read_test(f, zipfile.ZIP_STORED)
259 self.zip_readline_test(f, zipfile.ZIP_STORED)
263 self.zip_readlines_test(f, zipfile.ZIP_STORED)
267 self.zip_iterlines_test(f, zipfile.ZIP_STORED)
272 self.zip_test(f, zipfile.ZIP_DEFLATED)
277 self.zip_open_test(f, zipfile.ZIP_DEFLATED)
282 self.zip_random_open_test(f, zipfile.ZIP_DEFLATED)
288 self.zip_readline_read_test(f, zipfile.ZIP_DEFLATED)
293 self.zip_readline_test(f, zipfile.ZIP_DEFLATED)
298 self.zip_readlines_test(f, zipfile.ZIP_DEFLATED)
303 self.zip_iterlines_test(f, zipfile.ZIP_DEFLATED)
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:
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:
367 with zipfile.ZipFile(TESTFN2) as zipfp:
373 with zipfile.ZipFile(bio, 'w', zipfile.ZIP_STORED) as zipfp:
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)
414 with zipfile.ZipFile(TESTFN2, "w") as zipfp:
423 with zipfile.ZipFile(TESTFN2, "w") as zipfp:
424 zipfp.write(TESTFN, 'storeme', zipfile.ZIP_STORED)
425 zipfp.write(TESTFN, 'deflateme', zipfile.ZIP_DEFLATED)
428 self.assertEqual(sinfo.compress_type, zipfile.ZIP_STORED)
429 self.assertEqual(dinfo.compress_type, zipfile.ZIP_DEFLATED)
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:
548 zinfo = zipfile.ZipInfo()
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")
588 zipfp.writestr("a.txt", "hello world", compress_type=zipfile.ZIP_STORED)
590 zipfp.writestr("b.txt", "hello world", compress_type=zipfile.ZIP_DEFLATED)
593 self.assertEqual(info.compress_type, zipfile.ZIP_STORED)
597 self.assertEqual(info.compress_type, zipfile.ZIP_DEFLATED)
605 with zipfile.ZipFile(f, "r") as zipfp:
611 self.zip_test_writestr_permissions(f, zipfile.ZIP_STORED)
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:
634 raise zipfile.BadZipfile()
635 except zipfile.BadZipfile:
641 with zipfile.ZipFile(TESTFN2, "w") as zipfp:
654 self._limit = zipfile.ZIP64_LIMIT
655 self._filecount_limit = zipfile.ZIP_FILECOUNT_LIMIT
656 zipfile.ZIP64_LIMIT = 1000
657 zipfile.ZIP_FILECOUNT_LIMIT = 9
668 with zipfile.ZipFile(f, "w", compression) as zipfp:
669 self.assertRaises(zipfile.LargeZipFile,
673 with zipfile.ZipFile(f, "w", compression) as zipfp:
674 self.assertRaises(zipfile.LargeZipFile,
679 self.large_file_exception_test(f, zipfile.ZIP_STORED)
680 self.large_file_exception_test2(f, zipfile.ZIP_STORED)
684 with zipfile.ZipFile(f, "w", compression, allowZip64=True) as zipfp:
690 with zipfile.ZipFile(f, "r", compression) as zipfp:
746 self.zip_test(f, zipfile.ZIP_STORED)
751 self.zip_test(f, zipfile.ZIP_DEFLATED)
754 with zipfile.ZipFile(TESTFN2, "w", zipfile.ZIP_STORED,
758 with zipfile.ZipFile(TESTFN2, "r", zipfile.ZIP_STORED) as zipfp:
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)
786 with self.assertRaises(zipfile.LargeZipFile):
791 zipf = zipfile.ZipFile(TESTFN, mode="a", allowZip64=False)
794 with self.assertRaises(zipfile.LargeZipFile):
799 zipf = zipfile.ZipFile(TESTFN, mode="a", allowZip64=True)
808 zipf2 = zipfile.ZipFile(TESTFN, mode="r")
816 zipfile.ZIP64_LIMIT = self._limit
817 zipfile.ZIP_FILECOUNT_LIMIT = self._filecount_limit
836 with zipfile.PyZipFile(TemporaryFile(), "w") as zipfp:
848 with zipfile.PyZipFile(TemporaryFile(), "w") as zipfp:
865 with zipfile.PyZipFile(TemporaryFile(), "w") as zipfp:
888 zipfp = zipfile.PyZipFile(TemporaryFile(), "w")
900 with zipfile.PyZipFile(TemporaryFile(), "w") as zipfp:
909 zipfile.ZIP_STORED: (
918 zipfile.ZIP_DEFLATED: (
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:
968 zf = zipfile.ZipFile(TESTFN)
969 except zipfile.BadZipfile:
977 chk = zipfile.is_zipfile(TESTFN)
981 chk = zipfile.is_zipfile(fp)
986 chk = zipfile.is_zipfile(fp)
989 chk = zipfile.is_zipfile(fp)
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:
1011 chk = zipfile.is_zipfile(TESTFN)
1015 chk = zipfile.is_zipfile(fp)
1022 chk = zipfile.is_zipfile(fp)
1025 chk = zipfile.is_zipfile(fp)
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:
1071 self.assertRaises(RuntimeError, zipfile.ZipFile, TESTFN, "q")
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:
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:
1126 self.assertEqual(zipfile.sizeEndCentDir, 22)
1127 self.assertEqual(zipfile.sizeCentralDir, 46)
1128 self.assertEqual(zipfile.sizeEndCentDir64, 56)
1129 self.assertEqual(zipfile.sizeEndCentDir64Locator, 20)
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:
1192 self.check_testzip_with_bad_crc(zipfile.ZIP_STORED)
1196 self.check_testzip_with_bad_crc(zipfile.ZIP_DEFLATED)
1203 with zipfile.ZipFile(io.BytesIO(zipdata), mode="r") as zipf:
1204 self.assertRaises(zipfile.BadZipfile, zipf.read, 'afile')
1207 with zipfile.ZipFile(io.BytesIO(zipdata), mode="r") as zipf:
1209 self.assertRaises(zipfile.BadZipfile, corrupt_file.read)
1212 with zipfile.ZipFile(io.BytesIO(zipdata), mode="r") as zipf:
1215 with self.assertRaises(zipfile.BadZipfile):
1220 self.check_read_with_bad_crc(zipfile.ZIP_STORED)
1224 self.check_read_with_bad_crc(zipfile.ZIP_DEFLATED)
1232 with zipfile.ZipFile(io.BytesIO(), "w", compression) as zipf:
1239 self.check_read_return_size(zipfile.ZIP_STORED)
1243 self.check_read_return_size(zipfile.ZIP_DEFLATED)
1248 with zipfile.ZipFile(TESTFN, mode="w") as zipf:
1251 zipf = zipfile.ZipFile(TESTFN, mode="r")
1253 except zipfile.BadZipfile:
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')
1274 zipfile.ZipInfo, 'seventies', (1979, 1, 1, 0, 0, 0))
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:
1388 self.zip_test(f, zipfile.ZIP_STORED)
1393 self.zip_test(f, zipfile.ZIP_DEFLATED)
1399 with zipfile.ZipFile(f, "r", compression) as zipfp:
1426 self.zip_open_test(f, zipfile.ZIP_STORED)
1431 self.zip_open_test(f, zipfile.ZIP_DEFLATED)
1437 with zipfile.ZipFile(f, "r", compression) as zipfp:
1452 self.zip_random_open_test(f, zipfile.ZIP_STORED)
1457 self.zip_random_open_test(f, zipfile.ZIP_DEFLATED)
1469 with zipfile.ZipFile(f, "w", zipfile.ZIP_DEFLATED) as zipfp:
1477 with zipfile.ZipFile(TESTFN2, mode="r") as zipf:
1490 with zipfile.ZipFile(TESTFN2, mode="r") as zipf:
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:
1723 self.read_test(f, zipfile.ZIP_STORED)
1728 self.readline_read_test(f, zipfile.ZIP_STORED)
1732 self.readline_test(f, zipfile.ZIP_STORED)
1736 self.readlines_test(f, zipfile.ZIP_STORED)
1740 self.iterlines_test(f, zipfile.ZIP_STORED)
1745 self.read_test(f, zipfile.ZIP_DEFLATED)
1751 self.readline_read_test(f, zipfile.ZIP_DEFLATED)
1756 self.readline_test(f, zipfile.ZIP_DEFLATED)
1761 self.readlines_test(f, zipfile.ZIP_DEFLATED)
1766 self.iterlines_test(f, zipfile.ZIP_DEFLATED)
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: