Nf=kdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZ ddlZejZn#e$r dZejZYnwxYw ddlZn #e$rdZYnwxYw ddlZn #e$rdZYnwxYwgdZGddeZGddeZexZZdZd Zd ZdZd Z d Z!d Z"d Z#dZ$dZ%dZ&dZ'dZ(dZ)e j*e(Z+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3d Z4dZ5dZ6dZ7e j*e6Z8dZ9dZ:dZ;dZdZ?dZ@d ZAdZBdZCdZDd ZEdZFd ZGd ZHd!ZId"ZJd#ZKdZLdZMd ZNd$ZOd%ZPd&ZQd'ZRd(ZSe j*eRZTdZUdZVdZWdZXdZYdZZdZ[dZ\d Z]dZ^dZ_dZ`d)Zad*Zbe j*eaZcd+Zdd,Zee j*edZfdZgdZhdZidZjdZkdZldZmdZnd ZodZpd-Zqe jrd.Zsd/Ztd0Zud1Zvd2Zwd3ZxGd4d5eyZzda{d6Z|d7Z}Gd8d9Z~Gd:d;Zidd<dd=dd>dd>dd>dd>dd?dd@d dAddBdd?d dCd dDd#dEdFdGdHdIdJdKZdLZdgdMZdNZGdOdPZGdQdRZGdSdTejZGdUdVejZGdWdXZGdYdZeZd[Zd\ZejZ d]ZGd^d_eZGd`daeZdgdbZGdcddZdgdeZedfkr edSdS)hzP Read and write ZIP files. XXX references to utf-8 need further investigation. N) BadZipFile BadZipfileerror ZIP_STORED ZIP_DEFLATED ZIP_BZIP2ZIP_LZMA is_zipfileZipInfoZipFile PyZipFile LargeZipFilePathceZdZdS)rN)__name__ __module__ __qualname__/usr/lib/python3.11/zipfile.pyrr,sDrrceZdZdZdS)rzu Raised when writing a zipfile, the zipfile requires ZIP64 extensions and those extensions are disabled. N)rrr__doc__rrrrr0srri -.?s<4s4H2LHsPK z<4s4B4HL2L5H2LsPK  @iz <4s2B4HL2L2HsPKz<4sLQLsPKz <4sQ2H2L4QsPKiPK'F &F?%-F !"!*F F9#F; Ms ! 00c|dd|} |t dn#t$rYdSwxYw|}t |tkr|ddt kr|dddkrrtjt|}t|}| d| |tz t|t |St|dz tz d}||d|}|t }|dkr|||tz}t |tkrdSttjt|}|t}||tz|tz|z}| || ||zt|||z|z |SdS) zReturn data from the "End of Central Directory" record, or None. The data is a list of the nine items in the ZIP "End of central dir" record followed by a tenth item, the file seek offset of this record.rr"Nr$sri)rQtellsizeEndCentDirrErJr6stringEndArchiverSr5structEndArchivelistr7rqmaxrfind_ECD_COMMENT_SIZE) r`filesizercrbmaxCommentStartr=recData commentSizecomments rrDrDs IIaOOOyy{{H  >/1%%%% tt 99;;D D ^## QqS %%% RSS [  /66F||  c h/000TN?F;;;(g.?CCOIIoq!!! 99;;D JJ' ( (E zzuU>112 w<<> ) )4fm$4g>>??./ u^+E.,@,LLM g o-...T?U#:X#E#%% % 4sA AAc\eZdZdZdZddZdZddZd Zd Z e dd d d Z dZ dS)r z>Class with attributes describing each file in the ZIP archive.) orig_filenamerN date_time compress_type_compresslevelrr9 create_systemriextract_versionreserved flag_bitsvolume internal_attr external_attr header_offsetCRC compress_size file_size _raw_time _end_offsetNoNamer!r!rrrcf||_|td}|dkr |d|}tjdkr.tj|vr |tjd}||_||_|ddkrtdt|_ d|_ d|_ d|_ tjdkrd|_nd|_t"|_t"|_d|_d|_d|_d|_d|_d|_d|_d|_dS)Nr/rz+ZIP does not support timestamps before 1980rwin32r#)rfindchrossepreplacerNr ValueErrorrrrrr9sysplatformrDEFAULT_VERSIONrirrrrrrrrr)selfrNr null_bytes r__init__zZipInfo.__init__ts*%MM#a&&)) >>) ,H 6S==RVx//''44H  " Q<$  JKK K("  <7 " "!"D  "#D -.  rcd|jjd|jg}|jtkr;|dt |j|jz|jdz }|jdz}|r*|dtj |z|r|d|z| }|r|j r|d|j z|r|j r=|jtks|j |j kr|d |j z|d d |S) N) __class__rrNrrr7compressor_namesgetrstatfilemodeis_dirrrr8)rrOhiloisdirs r__repr__zZipInfo.__repr__s{'+~'>'>'> NO   + + MM-*..t/A/3/ACCC D D D 2 %  & (  > MM.4=+<+<< = = =  5 MM.3 4 4 4  < < MM/DN: ; ; ; D$, D  : - - ^t1 1 1 MM-0BB C C C cwwvrNc|j}|ddz dz|ddzz|dz}|ddz|d dzz|ddzz}|jtzrdx}x}}n|j}|j}|j}|j}d} ||tkp |tk}|r2d } |tj | dtj | d z ||z}|tks |tkr|std d }d }t} |j tkrtt | } n%|j t"krtt$| } t| |j|_t| |j|_|\} } tj t,t.|j|j| |j |||||t3| t3| } | | z|zS)z-Return the per-file header as a bytes object.rrr(r!r%r"r#r*r$Nz5 5 './ /C /-))(C .MI  = +J}{/JE  ]CFK()6?3+?+?+A9m]]]E { " "mk&A&A N"#LMMM#I&M'K   * *m[99KK  8 + +lK88K";0DEE!+t/BCC"7799)-/?!14=)!/'3*I ]]CJJ 88  5((rc |jd|jfS#t$r,|jd|jtzfcYSwxYw)Nasciiutf-8)rNencoderUnicodeEncodeError_MASK_UTF_FILENAMErs rrzZipInfo._encodeFilenameFlagssm V=''00$.@ @! V V V=''00$.CU2UU U U U Vs #3AAc|j}tj}t|dkr*|d|dd\}}|dzt|krt d||fz|dkr|d|dz} |jdvr'd}|d|dd\|_|dd}|jd kr'd }|d|dd\|_|dd}|jd krd }|d|dd\|_n'#tj$rt d |d dwxYw||dzd}t|dk(dSdS)Nr$r2z"Corrupt extra field %04x (size=%d)r!)lrz File sizez#>q#ABBajRVRY///abbkGajRVRY///   sNGGY''!zF2r9  )EO   4 '    jEO rc$|jddkS)z2Return True if this archive member is a directory.rrNrs rrzZipInfo.is_dir-s}R C''r)rrN) rrrr __slots__rrrrr classmethodrrrrrr r YsHHI0' ' ' ' X,,),),),)\VVV !!!:#D####[#J(((((rr cPtdD]}|dzr |dz dz }|dz}|S)Nrr!l q[)range)crcrAs r_gen_crcr7sC 1XX 7 !8z)CC AICC Jrcdddt/tttt datfdfd|D] }|fd}|S)NixV4igE#ixV4c,|dz ||z dzz S)z(Compute the CRC32 primitive on one byte.rr)chrcrctables rcrc32z_ZipDecrypter..crc32Qs qHcBh$%6777rcj|dzzdzdzdzdzdz dS)Nrrir!r)crkey0key1key2s r update_keysz"_ZipDecrypter..update_keysUsRuQ~~t $ 2y 1$ 2uTRZ&&rct}|j}|D].}dz}|||dz zdz dzz}|||/t|S)zDecrypt a bytes object.r"r!rr) bytearrayr7bytes)rcrOr7rkrrs r decrypterz _ZipDecrypter..decrypter_so  AqA 1!9"d* *A KNNN F1IIIIV}}r) _crctablerxmaprr) pwdpr rrrrrrs @@@@@@r _ZipDecrypterrGs D D DXuSzz2233 H88888'''''''' A       rc&eZdZdZdZdZdZdS)LZMACompressorcd|_dSr)_comprs rrzLZMACompressor.__init__os  rctjdtji}tjtjtjtj|g|_tjdddt||zS)Nidfiltersz??FE4#$$E 11s0.t/@/3/?!e) /LNNKDL#AIJJ/D ((..<# rN)rrrrr*rrrr$r$s2 rr$storeshrinkreduceimplodetokenizedeflate deflate64bzip2rterselz77awavpackbppmdc |tkrdS|tkrtstddS|tkrt stddS|t krtstddStd)Nz.Compression requires the (missing) zlib modulez-Compression requires the (missing) bz2 modulez.Compression requires the (missing) lzma modulez(That compression method is not supported) rrzlib RuntimeErrorrbz2r rNotImplementedError) compressions r_check_compressionrAsj     $ $ B@BB B B B  ! ! A?AA A A A   B@BB B B B""LMMMrcN|tkrL| tj|tjdStjtjtjdS|t kr)|t j|St jS|tkrtSdS)N) rr< compressobjDEFLATEDZ_DEFAULT_COMPRESSIONrr> BZ2Compressorr r)r compresslevels r_get_compressorrIs $$  $#M4=#FF F :DM3OOO ) # #  $$]33 3 """ ( " "trclt||tkrdS|tkrtjdS|t krt jS|tkrtSt |}|rtd||fztd|fz)NrCzcompression type %d (%s)zcompression type %d) rArrr< decompressobjrr>BZ2Decompressorr r$rrr?)rdescrs r_get_decompressorrNs}%%% ""t , & &!#&&& ) # #"$$$ ( " "!!! $$]33  P%&@MSXCY&YZZ Z%&;}>N&NOO Orc0eZdZdZdZd dZd dZdZdS) _SharedFilecd||_||_||_||_||_|j|_dSr)_file_pos_close_lock_writingseekable)rfileposcloselockwritings rrz_SharedFile.__init__s2       rc|jSr)rSrs rrtz_SharedFile.tells yrrc |j5|rtd|j|||j|_|jcdddS#1swxYwYdS)Nz}Can't reposition in the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.)rUrVrrRrQrtrS)rrawhences rrQz_SharedFile.seeks Z  }} K "JKKK JOOFF + + + ))DI9                  sA#A88A<?A<rc<|j5|rtd|j|j|j|}|j|_|cdddS#1swxYwYdS)NyCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.)rUrVrrRrQrSrJrtrnrcs rrJz_SharedFile.reads Z  }} K "JKKK JOODI & & &:??1%%D ))DI                  sAlines rrzZipExtFile.readlinesm 199 %%eT\::Q>A1uu' a8    ))$666rr!cV|t|j|jz krn||}t||jkr$||j|jdz|_d|_n|xjt|zc_|j|j|jdzS)z6Returns buffered bytes without advancing the position.Nri)r6r~rrJ)rrcchunks rpeekzZipExtFile.peeks s4#$$t|3 3 3IIaLLE5zzDL((#(4+;DLMM+J#J    E *  dlS.@ @AArc2|jrtddS)NI/O operation on closed file.T)rrrs rreadablezZipExtFile.readables ; ><== =trc|jrtd||dkrO|j|jd}d|_d|_|js$|||jz }|j$|S||jz}|t|jkr|j|j|}||_|S|t|jz }|j|jd}d|_d|_|dkro|jsh||}|t|kr||_||_||d|z }n$||z }|t|z}|dkr|jh|S)zRead and return up to n bytes. If the argument is omitted, None, or negative, data is read and returned until EOF is reached. zread from closed file.Nrr)rrr~rr}_read1MAX_Nr6)rrcbufendrcs rrJzZipExtFile.readsx ; 7566 6 9A"4<==1C"D DLi /t{{4:...i /J$, T%&& & &"4<#34CDLJ #d&'' 't|}}- !eeDIe;;q>>D3t99}}#'   tBQBx 4KC TNA!eeDIe rc|jdSt||j|_|jr'|j|jkrt d|jzdSdS)NzBad CRC-32 for file %r)rrrr}rr)rnewdatas r _update_crczZipExtFile._update_crcsh   % F!'4+<== 9 C*d.@@@5 ABB B C C@@rcn||dkrT|j|jd}d|_d|_|js)||j}|r||z }n|j)|S||jz}|t |jkr|j|j|}||_|S|t |jz }|j|jd}d|_d|_|dkrZ|jsS||}|t |kr||_||_||d|z }n|r||z }n|jS|S)z7Read up to n bytes with at most one read() system call.Nrr)r~rr}rrr6)rrcrrcrs rread1zZipExtFile.read1sk 9A"4<==1C"D DLi {{4:..4KC i  J$, T%&& & &"4<#34CDLJ #d&'' 't|}}- q55i {{1~~s4yy=='+D$#$DL48OC4KCi  rcl|js|dkrdS|jtkrH|jj}|t |kr(|||t |z z }n||}|jtkr|jdk|_n|jtkr}t||j }|j ||}|jj p|jdko |jj |_|jr||j z }n6|j |}|jj p |jdk|_|d|j}|xjt |zc_|jdkrd|_|||S)NrrT)r}ryrr|unconsumed_tailr6_read2rrzry MIN_READ_SIZEr*r(r"r{rrbs rrzZipExtFile._read1s 9 Q3  , . .%5D3t99}} AD M222;;q>>D  * , ,+q0DII  L 0 0At)**A%00q99D+/@,1@!/?? Iy 3*00222%0066D*.J$2E2JDIKTZK  c$ii :??DI  rc,|jdkrdSt||j}t||j}|j|}|xjt |zc_|st|j||}|S)Nrr) rzryrminrvrJr6EOFErrorrrbs rrzZipExtFile._read2s  ! # #3 4% & & 4& ' '}!!!$$ s4yy( N ? &??4((D rc |jr|jtdS#twxYwr)rxrvrZsuperrrs rrZzZipExtFile.close'sR " & ##%%% GGMMOOOOOEGGMMOOOOs A"A'c<|jrtd|jSNr)rrrrs rrWzZipExtFile.seekable.s# ; ><== =~rrc^|jrtd|jstjd|}|dkr|}n,|dkr||z}n |dkr |j|z}ntd||jkr|j}|dkrd}||z }||jz}|dkr"|t|j kr ||_d}n|dkr|j |j |j |_|j|_|j|_d|_ d|_t%|j|_d|_|}|j||dkr5t1|j|}||||z}|dk5|S) Nzseek on closed file.!underlying stream is not seekablerr!r"zCwhence must be os.SEEK_SET (0), os.SEEK_CUR (1), or os.SEEK_END (2)rF)rrrrUnsupportedOperationrtrrr6r~rvrQrrrrrzr{rNryr|r}rrr MAX_SEEK_READrJ)rrar_curr_posnew_pos read_offset buff_offsetread_lens rrQzZipExtFile.seek3s ; 5344 4~ O)*MNN N99;; Q;;GG q[['GG q[[*V3GGCDD D T) ) )*G Q;;G( !DL0 !   c$2B.C.C C C&DLKK 1__ M  t8 9 9 9 $ 4D "&":D -DJ"D DL!243F!G!GD DI!K*$$&&&Aoo4-{;;H IIh    8 #KAoo yy{{rc|jrtd|jstjd|j|jz t|jz |j z}|S)Nztell on closed file.r) rrrrrrr{r6r~r)rfileposs rrtzZipExtFile.tellesc ; 5344 4~ O)*MNN N&3c$:J6K6KKdlZr)NFrgr!rf)rrrrrrrrrrrrrrJrrrrrZrWrQrt __classcell__rs@rrtrt%sX EMM37$0W0W0W0Wf + + +   7777 B B B B !!!!FCCC###J"""H  0000drrtcFeZdZdZedZdZdZfdZxZ S) _ZipWriteFilec||_||_||_t|j|j|_d|_d|_d|_ dSrk) _zinfo_zip64_zipfilerIrr _compressor _file_size_compress_size_crc)rzfrrs rrz_ZipWriteFile.__init__osP   *5+>+0+?AA rc|jjSr)rrGrs rrvz_ZipWriteFile._fileobjys }rcdS)NTrrs rwritablez_ZipWriteFile.writable}strc|jrtdt|ttfrt |}nt |}|j}|xj|z c_t||j |_ |j r7|j |}|xj t |z c_ |j||Sr)rrrrrr6 memoryviewnbytesrrrrr rrvrn)rrcrs rrnz_ZipWriteFile.writes ; ><== = dUI. / / !YYFFd##D[F 6!$ **   -#,,T22D   3t99 ,   D!!! rc L|jrdS t|jrb|j}|xjt |z c_|j||j|j _ n|j |j _ |j |j _ |j |j _|j jt zr|jrdnd}|jt%j|t(|j j |j j |j j|j|j_n|js>|j t0krt3d|jt0krt3d|j|j_|j|j j|j|j |j|j|jj|jj|j |j |jj|j j <d|j_!dS#d|j_!wxYw)Nz*> ''{Q44*IKKK*[88*OQQQ +/-*<*<*>*> ' ""4;#<=== ##DK$:$:4;$G$GHHH ""4=#:;;; M " ) )$+ 6 6 6=A[DM $T[%9 :%*DM " " "UDM " * * * *s I;JJ#) rrrrpropertyrvrrnrZrrs@rrrns  X &,+,+,+,+,+,+,+,+,+rrc,eZdZdZdZdZdeddfddddZdZdZ d Z d Z d Z d Z d%d ZdZdZdZedZejdZd%dZd&dddZd'dZd(dZd)dZedZdZdZ d)dZ d(dZd*d Z d!Z!d"Z"d#Z#d$Z$dS)+r ai Class with methods to open, read, write, close, list zip files. z = ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=True, compresslevel=None) file: Either the path to the file, or a file-like object. If it is a path, the file will be opened and closed by ZipFile. mode: The mode can be either read 'r', write 'w', exclusive create 'x', or append 'a'. compression: ZIP_STORED (no compression), ZIP_DEFLATED (requires zlib), ZIP_BZIP2 (requires bz2) or ZIP_LZMA (requires lzma). allowZip64: if True ZipFile will create files with ZIP64 extensions when needed, otherwise it will raise an exception when this would be necessary. compresslevel: None (default for the given compression type) or an integer specifying the level to pass to the compressor. When using ZIP_STORED or ZIP_LZMA this keyword has no effect. When using ZIP_DEFLATED integers 0 through 9 are accepted. When using ZIP_BZIP2 integers 1 through 9 are accepted. NrT)rmetadata_encodingc|dvrtdt|||_d|_d|_i|_g|_||_||_||_ d|_ d|_ ||_ ||_ |j r|dkrtdt|tjrtj|}t|t$r[d|_||_d d d d d d dd}||} t+j|| |_n#t0$r| |vr || } Y5wxYwn$d|_||_t3|dd|_d|_t7j|_d|_d|_ |dkr| dS|dvrd|_ |j!|_" |j#|j"dS#tHt0f$r d|_YdSwxYw#tHt0f$r+tK|j|_d|_"d|_YdSwxYw|dkr | |j#|j"dS#tL$rD|j#ddd|_|j!|_"YdSwxYwtd#|j} d|_|'| xYw)z]Open the ZIP file with mode read 'r', write 'w', exclusive create 'x', or append 'a'.)rwxaz+ZipFile requires mode 'r', 'w', 'x', or 'a'FrNrrz5metadata_encoding is only supported for reading filesrKw+bx+br+bwbxb)rrrrrrrTr!r)rrrr"z"Mode must be 'r', 'w', 'x', or 'a')(rrA _allowZip64 _didModifydebugrrr@rHrr _comment_strict_timestampsrrrrrstr _filePassedrNrrMrGrEgetattr _fileRefCnt threadingRLockrUrrV_RealGetContentsrtrrQrrir_fpclose) rrXrr@ allowZip64rHrrmodeDictrrGs rrzZipFile.__init__ss + + +JKK K;'''%  &*  "3!2  ! IdckkGII I dBK ( ( #9T??D dC  8 D  DM"U%$T$@@H~H  gdH55DGG8++#+H#5    D DG#D&$77DM_&&  ' s{{%%'''''###' /%)W\\^^DN/ T^44444*G4///)./'0+++'00DG%&DN%*DNNNN+ 4))+++GLL00000!444GLLA&&&'+DO%)W\\^^DNNNN4!!EFFF BDG MM"    s8DD-+D-K% K%+H G++HK%HK% 8IK%I K%3JA KK%KK%%&L c|Srrrs r __enter__zZipFile.__enter__=s rc.|dSrrZ)rtypevalue tracebacks r__exit__zZipFile.__exit__@s rcd|jjd|jjg}|jg|jr|d|jzn$|j|d|jz|d|jzn|d|dd|S) Nrrz file=%rz filename=%rz mode=%rrrr) rrrrGrr7rNrr8rs rrzZipFile.__repr__Cs"n777"n99;< 7  > j4723333* nt}<=== MM*ty0 1 1 1 1 MM+ & & & cwwvrc |j} t|}n#t$rtdwxYw|std|jdkrt ||t }|t}|t|_ |t|z |z }|ttkr|ttzz}|jdkr||z}t d|||||z|_|jdkrtd||jd||}t%j|}d}||kr|t(} t+| t(krtdt-jt0| } | t2t4krtd|jdkrt | || t6} | t8} | t:zr| d } n| |jpd } tA| } || tB| _"|| tF| _$| tJ| _&| dd \ | _'| _(| _)| _*| _+| _,} }| _-| _.| _/| j)t`krtcd | j)d z z| dd\| _2| _3| _4| | _5|dz dz|dz dz|dz| dz | dz dz| dzdzf| _6| 7| j&|z| _&|j89| | |j:| j;<|t(z| t6z| tBz| tFz}|jdkrt d|||k|j}ty|j8ddD]}||_=|j&}dS)z/Read in the table of contents for the ZIP file.zFile is not a zip filer!r"zgiven, inferred, offsetrz Bad offset for central directoryzTruncated central directoryz&Bad magic number for central directoryrcp437rzzip file version %.1fr)r,r/r(rr%rr*r totalc|jSr)r)rs rz*ZipFile._RealGetContents..s e.ArT)keyreverseN)>rGrDrErrprintr^r_ _ECD_COMMENTr _ECD_LOCATIONrYrXrVrRrrQrJrBytesIOsizeCentralDirr6rSr5structCentralDir _CD_SIGNATUREstringCentralDir_CD_FILENAME_LENGTH _CD_FLAG_BITSrdecoderr _CD_EXTRA_FIELD_LENGTHr9_CD_COMMENT_LENGTHr_CD_LOCAL_HEADER_OFFSETrrirrrrrrrrMAX_EXTRACT_VERSIONr?rrrrrrrr7rrNsortedr)rrGrbsize_cd offset_cdconcatinferredrcrcentdirrNflagsrtd end_offsetrs rrzZipFile._RealGetContentsQsL W 7 __FF 7 7 7566 6 7 7566 6 :>> &MMM#;' |,  &09< . !%7 7 7 '*AA BF :>> )H +Y& I I I"V+ >A  ?@@ @ """www Z  googgn--G7||~-- !>???m$4g>>G}%)999 !IJJJzA~~gwww':;<>AG(: ;<AO5z$ZipFile.namelist..s888$ 888rrrs rnamelistzZipFile.namelists88$-8888rc|jS)zJReturn a list of class ZipInfo instances for files in the archive.r'rs rinfolistzZipFile.infolist }rctddz||jD]5}d|jddz}td|j||jfz|6dS)z+Print a table of contents for the zip file.z%-46s %19s %12s)z File Namez Modified SizerXz%d-%02d-%02d %02d:%02d:%02dNr&z %-46s %s %12d)r rrrNr)rrXrdates rprintdirzZipFile.printdirs "GG    ]  E05?2A23FFD /U^T5?$KK       rcd}|jD]z} ||jd5}||r ||dddn #1swxYwYb#t$r |jcYcSwxYwdS)z%Read all the files and check the CRC.irN)rrMrNrJr)r chunk_sizerfs rtestzipzZipFile.testzips ] & &E &YYu~s33q&&,,&&,, & & &~%%%%% & & &s4A,,A  A, A$ $A,'A$ (A,,BBcb|j|}|td|z|S)z,Return the instance of ZipInfo given 'name'.Nz(There is no item named %r in the archive)rrKeyError)rrinfos rgetinfozZipFile.getinfos@""4(( <:TACC C rc|r9t|ts$tdt|jz|r ||_dSd|_dS)z)Set default password for encrypted files.pwd: expected bytes, got %sN)rr TypeErrorrrr )rr s r setpasswordzZipFile.setpasswordsX  Pz#u-- P9DIIt@zr|!d} n|!j"pd} | |j#krt'd|j#d|d|j$=|%|j&z|j$krt'd|j#d|jtNz} | rY|sj(}|r9t|tRs$tUdtW|j,z|st[d|znd}t]||||dS#|/xYw)auReturn file-like object for 'name'. name is a string for the file name within the ZIP file, or a ZipInfo object. mode should be 'r' to read a file already in the ZIP file, or 'w' to write to a file newly added to the archive. pwd is the password to decrypt files (only used for reading). When writing, if the file size is not known in advance but may exceed 2 GiB, pass force_zip64 to use the ZIP64 format, which can handle large files. If the size is known in advance, it is best to pass a ZipInfo instance for name, with zinfo.file_size set. >rrzopen() requires mode "r" or "w"rz'pwd is only supported for reading filesz2Attempt to use ZIP archive that was already closedrFrar!cjSr)rVrsrrzZipFile.open..s $-rzTruncated file headerz Bad magic number for file headerz$compressed patched data (flag bit 5)zstrong encryption (flag bit 6)rrzFile name in directory z and header z differ.NzOverlapped entries: z (possible zip bomb)r:z6File %r is encrypted, password required for extractionT)0rrGrr r@rrHrr8_open_to_writerVrrPrrrUrJsizeFileHeaderr6rrSr5r _FH_SIGNATUREr_FH_FILENAME_LENGTH_FH_EXTRA_FIELD_LENGTHr_MASK_COMPRESSED_PATCHr?_MASK_STRONG_ENCRYPTION_FH_GENERAL_PURPOSE_FLAG_BITSrrrrrrtr_MASK_ENCRYPTEDr rr;rrr=rtrZ) rrrr rGrzef_filefheaderfname fname_str is_encrypteds ` rrMz ZipFile.opens z ! !>?? ?  HDCKKFGG Gw FDFF F dG $ $ 'EE S[[DMME"&"2E #'#5E LL&&E 3;;&&u+&FF F = GFGG G Atw(;#}dj:O:O:O:OQQ4 mmN33G7||~-- !8999m$4g>>G}%)999 !CDDDMM'*=">??E-. ? g&<=>>>!77 R)*PQQQ!88 L)*JKKK458JJ L!LL11 !LL)?)J7KK E/// j***EEE3444!- %"558III !c8K!c!c!cddd!?_ ) GLL ( ( ("gllnn   e&&u--... T5%000rc|tj}ntj|}||||S)a#Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a ZipInfo object. You can specify a different directory using `path'. )rgetcwdr_extract_member)rmemberrr s rextractzZipFile.extract~s; <9;;DD9T??D##FD#666rc||}|tj}ntj|}|D]}||||dS)zExtract all members from the archive to the current working directory. `path' specifies a different directory to extract to. `members' is optional and must be a subset of the list returned by namelist(). N)r(rr]rr^)rrmembersr rs r extractallzZipFile.extractallsi ?mmooG <9;;DD9T??D 5 5G  $ 4 4 4 4 5 5rc&|j}|s4d}t|dt|z}||_||}d||D}|d|D}|S)z;Replace bad characters and remove trailing dots from parts.z:<>|"?*_c3@K|]}|dVdS)rN)rstripr%rs r z1ZipFile._sanitize_windows_name..s,AAQ188C==AAAAAArc3K|]}||V dSrrrhs rriz1ZipFile._sanitize_windows_name..s'77QQ7q777777r)!_windows_illegal_name_trans_tabler maketransr6 translatesplitr8)rrpathseptableillegals r_sanitize_windows_namezZipFile._sanitize_windows_names5 :GMM'3W+=>>E49C 1##E**AA'--*@*@AAA,,77'77777rcrt|ts||}|jdt jj}t jjr4|t jjt jj}t j |d}dt jj t jj ft jj fd| t jjD}t jjdkr%||t jj}t j ||}t j|}t j|}|r3t j|st j||r5t j|st j||S|||5}t-|d5}t/j||dddn #1swxYwYdddn #1swxYwY|S) zbExtract the ZipInfo object 'member' to a physical file on the path targetpath. rr!rc3$K|] }|v|V dSrr)r%rinvalid_path_partss rriz*ZipFile._extract_member..s>#C#C&'/A&A&A$%&A&A&A&A#C#Cr\r rN)rr r8rNrrrrrrcurdirpardirr8rnrrrdirnameexistsmakedirsrrmkdirrMshutil copyfileobj) rr_ targetpathr r upperdirssourcetargetrus @rr^zZipFile._extract_members&'** *\\&))F/))#rw{;; 7> CoobgnbgkBBG'$$W--a0 "'."'.A'+""#C#C#C#CgmmBGK.H.H#C#C#CCC 7;$  11'27;GGGW\\*g66 W%%j11 GOOJ//  #RW^^I66 # K " " " ==?? 7==,, %$$$  YYv3Y ' ' /6 *d # # /'-  vv . . . / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /s6"J,3J J,J J,J J,,J03J0c|j|jvr#ddl}|d|jzd|jdvrt d|jst dt|j|j s[d}t|j tkrd }n%|j tkrd }n|jtkrd }|rt!|d zdSdS) z6Check for errors before writing a file to the archive.rNzDuplicate name: %rr#r?rrrz&write() requires mode 'w', 'x', or 'a'z4Attempt to write ZIP archive that was already closed Files countFilesizez Zipfile size would require ZIP64 extensions)rNrrBrCrrrGrArrr6rZIP_FILECOUNT_LIMITrrrr)rrrBrequires_zip64s rr[zZipFile._writechecks >T_ , , OOO MM.?AM N N N 9O + +EFF Fw HFHH H5./// F!N4=!!%888!.;..!+${22!/ F">#D$EFFF F F F FrcF|jstd|jrtdt|||j}|r%d|_d|_| |dS|||_ n |j |_ |||_ n |j |_ t|d5}||d5}tj||ddddn #1swxYwYddddS#1swxYwYdS) zLPut the bytes from filename into the archive under the name arcname.7Attempt to write to ZIP archive that was already closedz>Can't write to ZIP archive while an open writing handle existsrrNrKri )rGrrVr rrrrrr}rr@rrHrMr~r)rrNrrrHrsrcdests rrnz ZipFile.writesw KIKK K = P !!(G484K"MM <<>> 6"#E EI JJu     (&3##&*&6#('4$$'+'9$h%% 6diis.C.C 6t"3f555 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6s6DC>2 D>D DD DDDct|tr|d}t|tst|t jt jdd}|j|_|j|_ |j ddkrd|_ |xj dzc_ n d |_ n|}|j std |jrtd |||_|||_ t||_|j5||d 5}||dddn #1swxYwYddddS#1swxYwYdS)aWrite a file into the archive. The contents is 'data', which may be either a 'str' or a 'bytes' instance; if it is a 'str', it is encoded as UTF-8 first. 'zinfo_or_arcname' is either a ZipInfo instance or the name of the file in the archive.rNr&)rNrrriAr-rYrz?Can't write to ZIP archive while an open writing handle exists.r)r)rrrr rrr@rrHrrNrrGrrVr6rrUrMrn)rzinfo_or_arcnamercrrHrrs rwritestrzZipFile.writestr s dC  (;;w''D*G44 %%5&*nTY[[&A&A"1"&EGGGE"&"2E #'#5E ~b!S((&3###t+###&1##$Ew KIKK K = Q   $"/E   $#0E d)) Z ! !5s++ !t 4    ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !s6 E28E E2E E2!E "E22E69E6ct|tr&|}|stdnt|tra|}|ds|dz }t|}d|_d|_d|zdzdz|_d|_ |xjdzc_ntd|j 5|j r|j |j|j |_|jt&kr|xjt*zc_||d|_|j|||j|j<|j |d |j |_d d d d S#1swxYwYd S) z+Creates a directory inside the zip archive.z/The given ZipInfo does not describe a directoryrri@rr-zExpected type str or ZipInfoTFN)rr rrrendswithrrrrr;rUrrGrQrrtrrr rrZr[rrr7rrNrnr)rzinfo_or_directory_namerrdirectory_names rr}z ZipFile.mkdir6s -w 7 7 <+E<<>> T !RSSS T / 5 5 <4N!**3// &#%N++E"#E EI$+dNf#<"CE EO   4 '   :;; ; Z , ,~ - T^,,,"&',,..E "h..#::   U # # #"DO M  ' ' '.3DOEN + GMM%**511 2 2 2!W\\^^DN , , , , , , , , , , , , , , , , , ,sC:GGGc.|dS)z2Call the "close()" method in case the user forgot.Nrrs r__del__zZipFile.__del__Ys rc|jdS|jrtd |jdvr`|jrY|j5|jr|j|j| dddn #1swxYwY|j}d|_| |dS#|j}d|_| |wxYw)zOClose the file, and for mode 'w', 'x' and 'a' write the ending records.NzvCan't close the ZIP file while there is an open writing handle on it. Close the writing handle before closing the zip.r) rGrVrrrrUrrQr_write_end_recordrrls rrZz ZipFile.close]s/ 7? F = QPQQ Q yO+++Z--~5 T^444**,,,--------------- BDG MM"     BDG MM"    s.B/;A?3 B/?BB/BB//%CcR |jD]}|j}|ddz dz|ddzz|dz}|ddz|d dzz|ddzz}g}|jtks|jtkr9||j||jd }d }n|j}|j}|jtkr||jd }n|j}|j} d} |rQt| d } tj d d t|zzddt|zg|R| z} t} |j tkrtt | } n%|j t"krtt$| } t| |j} t| |j} |\} }tj t,t.| |j| |j||j |||j||t| t| t|jd|j|j|}|j||j| |j| |j|j|j }t|j}||j!z }|j!}d}|tDkrd}n|tkrd}n |tkrd}|r|j#stI|dztj tJtLddddd|||| }|j|tj tNtPd|d}|j|tS|d}tS|d }tS|d }tj tTtVdd||||t|j, }|j||j|j,|j-dkr|j.|j/dS)Nrrr(r!r%r"r#r*r$rrr2QrrzCentral directory offsetzCentral directory sizer,rrr)0rrrrrr7rr9rBrSrr6rrrryrr rrrirrrrrrrrrrGrnrtrrrrrWrXrTrUrrwrvrrtruncater")rrrrrr9rrr extra_datarrrirNrrpos2 centDirCount centDirSize centDirOffsetr zip64endrec zip64locrecrbs rrzZipFile._write_end_recordssw]3 )3 )EB!ut|)BqEQJ6A>GerkBqEQJ."Q%1*=GE,,% 33 U_--- U0111& * !O % 3 "[00 U0111 * % 3 JK ,)*d;; #[CE N*qU|-&+---/9: , "i//!-== $00!, << !+u/DEEO e.BCCN"'"<"<">"> Hik"2"2N"'"5"+U-@'7"')]I"%h--Z#emBTBT"#U%8%:M"/11G GMM' " " " GMM( # # # GMM* % % % GMM%- ( ( ( (w||~~4=)) T^+   - - -*NN [ ( (7NN ; & &5N  ;# F">#D$EFFF +"$6BAq, ],,K GMM+ & & & +))1dA77K GMM+ & & &|V44Lk:66K z::M-/?<(-T]9K9KMM  f  dm$$$ 9   G       rc|jdksJ|xjdzc_|js|js|dSdSdS)Nrr!)rrrZrls rrzZipFile._fpclosesd!#### A (8  HHJJJJJ    rr)rN)F)NN)NNN)r)%rrrrrGrkrrrrrrr(r*r0r4r8r<rrsetterrJrMrJr`rcrrrr^r[rnrr}rrZrrrrrr r sx, B(,%"%:$#^:>RV^^^^^@   T-T-T-l999  & & &X ^  ^  dEdddddL'1'1'1'1R 7 7 7 75555"  [ (((TFFF.'+046666D48'!'!'!'!R!,!,!,!,F,\\\|rr c0eZdZdZdeddfdZd dZd ZdS) r zDClass to create ZIP archives with Python library files and packages.rTrcRt|||||||_dS)N)rr@r)r r _optimize)rrXrr@roptimizes rrzPyZipFile.__init__s5t$K$.  0 0 0!rrNc`tj|}|rL||sA|jr8tj|rdnd}t |d|ddStj|\}}tj|rtj|d}tj|r|r|d|}n|}|jrt d|d || |d d |\}} |jrt d | | || ttj |} | d| D]5} tj|| } tj| \} }tj| rVtjtj| dr|| || |dkru|r%|| s|jrt d| z| | d d |\}} |jrt d | | || 7dS|jrt d|ttj |D]} tj|| } tj| \} }|dkru|r%|| s|jrt d| zq| | d d |\}} |jrt d | | || dS|d ddkrt!d| |d d |\}} |jrt d| | || dS)aAdd all files from "pathname" to the ZIP archive. If pathname is a package directory, search the directory and all package subdirectories recursively for all *.py and enter the modules into the archive. If pathname is a plain directory, listdir *.py and enter all modules. Else, pathname must be a Python *.py file and the module will be put into the archive. Added modules are always module.pyc. This method will compile the module.py into module.pyc if necessary. If filterfunc(pathname) is given, it is called with every argument. When it is False, the file or directory is skipped. rrX z skipped by filterfuncNz __init__.pyrzAdding package inasrAdding) filterfunc.pyzfile %r skipped by filterfunczAdding files from directoryz.Files added with writepy() must end with ".py"z Adding file)rrrrrr rnr8isfile _get_codenamernrlistdirremovesplitextwritepyr=)rpathnamebasenamerlabeldirrinitnamerUrdirlistrNrrootexts rrzPyZipFile.writepys[9X&&  jj22 z I"$'--"9"9EvuuuhhhGHHH FGMM(++ T 7== " "; 'w||Hm<>"',,t]*K*KLL@ LLx4>)@@@%%jj.>.>%#zN %&E&L M M M$)-););D2J.>%#zN %&E&L M M M$)-););D2J._compile:s    z )k4((( ""4"IIII,   cguuuuu 4s7 A AA rz.pycr) optimizationr!r"rz"invalid value for 'optimize': {!r})rrrg) importlibutilcache_from_sourcerrrrrrrrrformatrrn) rrrrfile_pyfile_pyc pycache_opt0 pycache_opt1 pycache_opt2rrUr archivenames ` rrzPyZipFile._get_codename3s      e#f$ ~77b7QQ  ~77a7PP  ~77a7PP >R  x((! .'(##,0@0@0III"**%%'.... .',''0BGG4D4D4MMM%"'.... .',''0BGG4D4D4MMM%"'.... .',''0BGG4D4D4MMM%"8G$$ .y)Q.. ,+q00 , ,&GG&--EGG~""$"">Q&&(EE^q(((EE>EEdnUUC$S//)GNN5)) .GENN+rww/?/?/HHHx$.AAA.&--EGgmmG,,Q/  <%-XX{{;K{##r)rN)rrrrrrrrrrrr r seNN"%: 2"""" P'P'P'P'dP$P$P$P$P$rr cHtjt|ddS)a2 Given a path with elements separated by posixpath.sep, generate all parents of that path. >>> list(_parents('b/d')) ['b'] >>> list(_parents('/b/d/')) ['/b'] >>> list(_parents('b/d/f/')) ['b/d', 'b'] >>> list(_parents('b')) [] >>> list(_parents('')) [] r!N) itertoolsislice _ancestry)rs r_parentsrs  IdOOQ 5 55rc#K|tj}|tjr<|Vtj|\}}|tj:dSdS)a Given a path with elements separated by posixpath.sep, generate all elements of that path. >>> list(_ancestry('b/d')) ['b/d', 'b'] >>> list(_ancestry('/b/d/')) ['/b/d', '/b'] >>> list(_ancestry('b/d/f/')) ['b/d/f', 'b/d', 'b'] >>> list(_ancestry('b')) ['b'] >>> list(_ancestry('')) [] Multiple separators are treated like a single. >>> list(_ancestry('//b//d///f//')) ['//b//d///f', '//b//d', '//b'] N)rg posixpathrrn)rtails rrrsy* ;;y} % %D ++im $ $+ _T** d ++im $ $+++++rcPtjt|j|S)zZ Return items in minuend not in subtrahend, retaining order with O(1) lookup. )r filterfalseset __contains__)minuend subtrahends r _differencers  Z!=w G GGrcZeZdZdZedZfdZdZdZe dZ xZ S) CompleteDirszk A ZipFile subclass that ensures that implied directories are always included in the namelist. ctjtt|}d|D}t t ||S)Nc34K|]}|tjzVdSr)rr)r%rs rriz-CompleteDirs._implied_dirs..s)661y}$666666r)rchain from_iterabler r_deduper)namesparentsas_dirss r _implied_dirszCompleteDirs._implied_dirssL///He0D0DEE66g666{7E22333rctt|}|t||zSr)rrr(rxr)rrrs rr(zCompleteDirs.namelists?lD))2244tD..u556666rcDt|Sr)rr(rs r _name_setzCompleteDirs._name_sets4==??###rcP|}|dz}||vo||v}|r|n|S)zx If the name represents a directory, return that name as a directory (with the trailing slash). r)r)rrrrz dir_matchs r resolve_dirzCompleteDirs.resolve_dirs?   *%:'U*: #-ww-rct|tr|St|ts ||Sd|jvrt}||_|S)zl Given a source (filename or zipfile), return an appropriate CompleteDirs subclass. r)rrr rr)rrs rmakezCompleteDirs.makes\ fl + + M&'** 3v;;  fk ! !C r) rrrr staticmethodrr(rrrrrrs@rrrs 44\4 77777$$$...[rrc,eZdZdZfdZfdZxZS) FastLookupzV ZipFile subclass to ensure implicit dirs exist and are resolved rapidly. ctjt5|jcdddS#1swxYwYt t ||_|jSr) contextlibsuppressr_FastLookup__namesrrr(rs rr(zFastLookup.namelists   0 0  <                Z..7799 | /33ctjt5|jcdddS#1swxYwYt t ||_|jSr)rrr_FastLookup__lookuprrrrs rrzFastLookup._name_sets   0 0 ! != ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! !j$//99;; }r)rrrrr(rrrs@rrrs[  rrc2tj|d||fS)Nr#)r text_encoding)encodingargskwargss r_extract_text_encodingr s Ha ( ($ 66rceZdZdZdZddZddddZed Zed Z ed Z ed Z ed Z dZ dZdZdZdZdZdZdZdZdZdZeZedZdS)ru, A pathlib-compatible interface for zip files. Consider a zip file with this structure:: . ├── a.txt └── b ├── c.txt └── d └── e.txt >>> data = io.BytesIO() >>> zf = ZipFile(data, 'w') >>> zf.writestr('a.txt', 'content of a') >>> zf.writestr('b/c.txt', 'content of c') >>> zf.writestr('b/d/e.txt', 'content of e') >>> zf.filename = 'mem/abcde.zip' Path accepts the zipfile object itself or a filename >>> root = Path(zf) From there, several path operations are available. Directory iteration (including the zip file itself): >>> a, b = root.iterdir() >>> a Path('mem/abcde.zip', 'a.txt') >>> b Path('mem/abcde.zip', 'b/') name property: >>> b.name 'b' join with divide operator: >>> c = b / 'c.txt' >>> c Path('mem/abcde.zip', 'b/c.txt') >>> c.name 'c.txt' Read text: >>> c.read_text() 'content of c' existence: >>> c.exists() True >>> (b / 'missing.txt').exists() False Coercion to string: >>> import os >>> str(c).replace(os.sep, posixpath.sep) 'mem/abcde.zip/b/c.txt' At the root, ``name``, ``filename``, and ``parent`` resolve to the zipfile. Note these attributes are not valid and will raise a ``ValueError`` if the zipfile has no filename. >>> root.name 'abcde.zip' >>> str(root.filename).replace(os.sep, posixpath.sep) 'mem/abcde.zip' >>> str(root.parent) 'mem' z>{self.__class__.__name__}({self.root.filename!r}, {self.at!r})rcRt||_||_dS)aX Construct a Path from a ZipFile or filename. Note: When the source is an existing ZipFile object, its type (__class__) will be mutated to a specialized type. If the caller wishes to retain the original type, the caller should either create a separate ZipFile object or pass a filename. N)rrrat)rrr s rrz Path.__init__Y s"OOD)) rrNrwcl|rt||d}|s|dkrt||j|j||}d|vr|s|rtd|St|i|\}}}tj ||g|Ri|S)z Open this entry as text or binary following the semantics of ``pathlib.Path.open()`` by passing arguments through to io.TextIOWrapper(). rrrwbz*encoding args invalid for binary operation) rIsADirectoryErrorr{FileNotFoundErrorrrMr rrr TextIOWrapper)rrr rrzip_modestreamrs rrMz Path.openf s ;;== *#D)) )7{{}} *S#D)) )s;; $;; Ov O !MNNNM!7!H!H!H$B4BBB6BBBrcVtj|jjp |jjSr)pathlibrr rrNrs rrz Path.namez !|DG$$)?T]-??rcVtj|jjp |jjSr)rrr suffixrNrs rrz Path.suffix~ s!|DG$$+Ct}/CCrcVtj|jjp |jjSr)rrr suffixesrNrs rrz Path.suffixes s!|DG$$-G1GGrcVtj|jjp |jjSr)rrr stemrNrs rrz Path.stem rrcntj|jj|jSr)rrrrNjoinpathr rs rrNz Path.filename s'|DI.//88AAArct|i|\}}}|jd|g|Ri|5}|cdddS#1swxYwYdS)Nr)rrMrJ)rrrrstrms r read_textzPath.read_text s!7!H!H!H$ TYsH 6t 6 6 6v 6 6 $99;;                  sAA Ac|d5}|cdddS#1swxYwYdS)NrKrE)rrs r read_byteszPath.read_bytes s~ YYt__ 99;;                  s 7;;ctj|jd|jdkSNr)rrzr rg)rrs r _is_childzPath._is_child s4 !4!4559L9LLLrc8||j|Sr)rr)rr s r_nextz Path._next s~~di,,,rcF|j p|jdSr#)r rrs rrz Path.is_dir s!7{3dg..s333rcT|o| Sr)r{rrs ris_filez Path.is_file s {{}}2T[[]]!22rcB|j|jvSr)r rrrs rr{z Path.exists sw$)--////rc|stdt|j|j}t |j|S)NzCan't listdir a file)rrr r&rr(filterr$)rsubss riterdirz Path.iterdir sR{{}} 5344 44:ty113344dnd+++rcJtj|jj|jSr)rr8rrNr rs r__str__z Path.__str__ s~di0$':::rc8|j|S)Nr) _Path__reprrrs rrz Path.__repr__ s{!!t!,,,rctj|jg|R}||j|Sr)rr8r r&rr)rothernexts rrz Path.joinpath s=~dg....zz$)//55666rc|js |jjStj|jd}|r|dz }||Sr#)r rNparentrrzrgr&)r parent_ats rr7z Path.parent sYw (=' '%dgnnS&9&9::    Izz)$$$r)r)r)rrrrr2rrMrrrrrrNrr!r$r&rr)r{r.r0rr __truediv__r7rrrrr sKKZNF    CCCCCC(@@X@DDXDHHXH@@X@BBXB MMM---444333000,,, ;;;---777K %%X%%%rrcddl}d}||}|d}|dddd |d d d dd|ddddd|dddd |ddd ||}|j}|jz|j}t|d|5}|}dddn #1swxYwY|r"td |tddS|j H|j }t|d|5}| ddddS#1swxYwYdS|j L|j \}} t|d|5}|| ddddS#1swxYwYdS|j|r/td t j!t!jd"|jd} |j} fd#t| d$5}| D]} t(j| } | szShow listing of a zipfile)metavarhelpz-ez --extractr")r=z zExtract zipfile into target dir)nargsr>r?z-cz--create+)zzzCreate zipfile from sourcesz-tz--testzTest if a zipfile is validz--metadata-encodingz z2Specify encoding of member names for -l, -e and -tr)rz.The following enclosed file is corrupted: {!r}z Done testingz/Non-conforming encodings not supported with -c.r.r!c tj|r|||tdStj|r|r|||t tj|D]M}|tj||tj||LdSdSr) rrrrnrrrrr8)rrzippathnmaddToZips rrEzmain..addToZip sw~~d## Pw 55555t$$ P,HHT7+++ D!1!122PPBHRW\\$33RW\\'25N5NPPPP  P PPPrrr)argparseArgumentParseradd_mutually_exclusive_group add_argument parse_argsrtestr r4r rrxr0r`rccreaterstderrexitpoprrrrzrxry)rrFr;parsergrouprrrbadfilerxzip_namefilesrrCrEs @rmainrU sOOOGK  $ $ $ = =F  / / / > >E tX{7999 t[<=??? tZs39;;; tX{8::: -|QSSS   T " "D%H yi S# : : : #bjjllG # # # # # # # # # # # # # # #  T BII'RR S S S n  i S# : : : b KKMMM                    !l V S# : : : "b MM& ! ! ! " " " " " " " " " " " " " " " " " "    Cz # # # # HQKKK;??1%%  P P P P PXs # # ,r , ,'**400F g..rwt/D/DEEGr29bi888 GT7++++  , , , , , , , , , , , , , , , , , , ,) ! sI.DDD/FFFG$$G(+G( B K;;K?K?__main__r)rbinasciiimportlib.utilrrrrrrer~rrSrrrrrr<r ImportErrorr>r__all__ ExceptionrrrrrrrArrrr rrrrrrwrvrrurYrZr[r\r]r^r_r{r r rrrr_CD_CREATE_VERSION_CD_CREATE_SYSTEM_CD_EXTRACT_VERSION_CD_EXTRACT_SYSTEMr_CD_COMPRESS_TYPE_CD_TIME_CD_DATE_CD_CRC_CD_COMPRESSED_SIZE_CD_UNCOMPRESSED_SIZErrr_CD_DISK_NUMBER_START_CD_INTERNAL_FILE_ATTRIBUTES_CD_EXTERNAL_FILE_ATTRIBUTESrrRrZrrOrPrrrrKrL_FH_EXTRACT_VERSION_FH_EXTRACT_SYSTEMrQ_FH_COMPRESSION_METHOD_FH_LAST_MOD_TIME_FH_LAST_MOD_DATE_FH_CRC_FH_COMPRESSED_SIZE_FH_UNCOMPRESSED_SIZErMrNrTrUrRrWrXrV_CD64_SIGNATURE_CD64_DIRECTORY_RECSIZE_CD64_CREATE_VERSION_CD64_EXTRACT_VERSION_CD64_DISK_NUMBER_CD64_DISK_NUMBER_START_CD64_NUMBER_ENTRIES_THIS_DISK_CD64_NUMBER_ENTRIES_TOTAL_CD64_DIRECTORY_SIZE_CD64_OFFSET_START_CENTDIRrStructr4rBrHr rqrDobjectr r rrrr$rrArIrNrPrirrtrr r rrdictfromkeysrrrrrrrUrrrrrsD     KKK JEE D NEEEJJJJ CCCKKKK DDD            9    #        !122    $  !122     !!  #   "  !122  ! %))&/*CDD"""6?#566!" #fmE**& (((V:::zV(V(V(V(V(vV(V(V(z   ###L"""""""".8wxxx  x  x yzy{   !"#(NNN&     PPP$%!%!%!%!%!%!%!%!P(FFFFF"FFFR Q+Q+Q+Q+Q+B%Q+Q+Q+jR R R R R R R R jk$k$k$k$k$k$k$k$\666&+++6 -/HHH.....7...b&7777 v%v%v%v%v%v%v%v%rC,C,C,C,L zDFFFFFs6 A AA!A&&A0/A04A99BB