grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026o ®û|jÅdã@sLdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZddlZz ddlZejZWneyUdZejZYnwzddlZWn eygdZYnwzddlZWn eyydZYnwgd¢ZGdd„deƒZGdd„deƒZeZZdZd Zd ZdZd Z d Z!d Z"d Z#dZ$dZ%dZ&dZ'dZ(dZ)e  *e(¡Z+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3d Z4dZ5dZ6dZ7e  *e6¡Z8dZ9dZ:dZ;dZdZ?dZ@d ZAdZBdZCdZDd ZEdZFd ZGd ZHd!ZId"ZJd#ZKd$ZLd%ZMe  *eL¡ZNdZOdZPdZQdZRdZSdZTdZUdZVd ZWdZXdZYdZZd&Z[d'Z\e  *e[¡Z]d(Z^d)Z_e  *e^¡Z`dZadZbdZcdZddZedZfdZgdZhd ZidZjd*Zke  ld+¡Zmd,d-„Znd.d/„Zod0d1„Zpd2d3„Zqd4d5„ZrGd6d7„d7esƒZtdaud8d9„Zvd:d;„ZwGdd?„d?ƒZyidd@“ddA“ddB“ddB“ddB“ddB“ddC“ddD“d dE“ddF“ddC“d dG“d dH“d#dI“dJdK“dLdM“dNdO“ZzdPdQ„Z{dsdRdS„Z|dTdU„Z}GdVdW„dWƒZ~GdXdY„dYƒZGdZd[„d[ej€ƒZ�Gd\d]„d]ej€ƒZ‚Gd^d_„d_ƒZƒGd`da„daeƒƒZ„dbdc„Z…ddde„Z†e‡jˆZ‰ dfdg„ZŠGdhdi„dieƒƒZ‹Gdjdk„dke‹ƒZŒdsdldm„Z�Gdndo„doƒZŽdsdpdq„Z�e�drk�r$e�ƒdSdS)tzP Read and write ZIP files. XXX references to utf-8 need further investigation. éN) Ú BadZipFileÚ BadZipfileÚerrorÚ ZIP_STOREDÚ ZIP_DEFLATEDÚ ZIP_BZIP2ÚZIP_LZMAÚ is_zipfileÚZipInfoÚZipFileÚ PyZipFileÚ LargeZipFileÚPathc@s eZdZdS)rN)Ú__name__Ú __module__Ú __qualname__©rrú./opt/alt/python310/lib64/python3.10/zipfile.pyr,src@seZdZdZdS)r zu Raised when writing a zipfile, the zipfile requires ZIP64 extensions and those extensions are disabled. N)rrrÚ__doc__rrrrr 0sr iÿÿÿéÿÿéé ééé-é.é?s<4s4H2LHsPKéééééééé z<4s4B4HL2L5H2LsPKé é é ééééz <4s2B4HL2L2HsPKz<4sLQLsPKz <4sQ2H2L4QsPKiPKúr0r:Ústructr/ÚstructEndArchive64LocatorÚstringEndArchive64LocatorrÚsizeEndCentDir64Ú startswithÚstringEndArchive64ÚstructEndArchive64Ú_ECD_SIGNATUREÚ_ECD_DISK_NUMBERÚ_ECD_DISK_STARTÚ_ECD_ENTRIES_THIS_DISKÚ_ECD_ENTRIES_TOTALÚ _ECD_SIZEÚ _ECD_OFFSETÚ _ECD_LOCATION)ÚfpinÚoffsetÚendrecÚdataZsigZdisknoZreloffZdisksZextraszZszÚcreate_versionZ read_versionZdisk_numZdisk_dirZdircountZ dircount2ZdirsizeZ diroffsetrrrÚ _EndRecData64ÙsV           þ  rZc Cs`| dd¡| ¡}z | t d¡Wn tyYdSw| ¡}t|ƒtkrV|dd…tkrV|dd…dkrVt t |¡}t |ƒ}|  d¡|  |t¡t ||t|ƒSt |dtdƒ}| |d¡| ¡}| t¡}|dkr®|||t…}t|ƒtkr‚dSt t t |¡ƒ}|t}||t|t|…}|  |¡|  ||¡t ||||ƒSdS) zÔReturn 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.rrNr éþÿÿÿsr-i)rEÚtellÚsizeEndCentDirr:r>r0ÚstringEndArchiverFr/ÚstructEndArchiveÚlistr1rZÚmaxÚrfindÚ_ECD_COMMENT_SIZE) rUZfilesizerXrWZmaxCommentStartr5ZrecDataZ commentSizeÚcommentrrrr9s>  ÿ       r9c@s\eZdZdZdZddd„Zdd„Zdd d „Zd d „Zdd„Z e dddœdd„ƒZ dd„Z d S)r z>Class with attributes describing each file in the ZIP archive.)Ú orig_filenamerBÚ date_timeÚ compress_typeÚ_compresslevelrdr3Ú create_systemrYÚextract_versionÚreservedÚ flag_bitsÚvolumeÚ internal_attrÚ external_attrÚ header_offsetÚCRCÚ compress_sizeÚ file_sizeÚ _raw_timeÚ _end_offsetÚNoName©é¼rrrrrcCsÚ||_| tdƒ¡}|dkr|d|…}tjdkr%tj|vr%| tjd¡}||_||_|ddkr5tdƒ‚t |_ d|_ d|_ d|_ tjdkrJd|_nd|_t|_t|_d|_d|_d|_d|_d|_d|_d|_d|_dS)Nrú/rxz+ZIP does not support timestamps before 1980r-Zwin32r)reÚfindÚchrÚosÚsepÚreplacerBrfÚ ValueErrorrrgrhrdr3ÚsysÚplatformriÚDEFAULT_VERSIONrYrjrkrlrmrnrorrrsru)ÚselfrBrfZ null_byterrrÚ__init__ls6    zZipInfo.__init__cCsÜd|jj|jfg}|jtkr| dt |j|j¡¡|jd?}|jd@}|r2| dt   |¡¡|r;| d|¡|  ¡}|rD|j rL| d|j ¡|rQ|j rd|jtks\|j |j krd| d|j ¡| d ¡d  |¡S) Nz<%s filename=%rú compress_type=%sr)rz filemode=%rz external_attr=%#xz file_size=%rz compress_size=%rú>Ú)Ú __class__rrBrgrr1Úcompressor_namesÚgetroÚstatÚfilemodeÚis_dirrsrrr2)rƒrCÚhiÚloÚisdirrrrÚ__repr__˜s, ÿÿ        zZipInfo.__repr__NcCsx|j}|ddd>|dd>B|dB}|dd>|d d>B|ddB}|jd @r3d}}}n |j}|j}|j}|j}d} |d urM|tkpL|tk}|rad } |t | dt  | ¡d ||¡}|tksi|tkru|sot d ƒ‚d}d}t } |j t kr€tt| ƒ} n |j tkrŠtt| ƒ} t| |jƒ|_t| |jƒ|_| ¡\} } t tt|j|j| |j |||||t| ƒt|ƒ¡ } | | |S)z-Return the per-file header as a bytes object.rrxr$rr!rrr&r rNzz |j d¡|jfWSty|j d¡|jdBfYSw)NÚasciiúutf-8é)rBÚencoderlÚUnicodeEncodeError©rƒrrrr™Üs  ÿzZipInfo._encodeFilenameFlagscCs6|j}tj}t|ƒdkr™|d|dd…ƒ\}}|dt|ƒkr'td||fƒ‚|dkr‰|d|d…}zD|jdvrLd}|d|dd…ƒ\|_|dd…}|jd krdd }|d|dd…ƒ\|_|dd…}|jd krvd }|d|dd…ƒ\|_Wntjyˆtd |›d �ƒd‚w||dd…}t|ƒdks dSdS)Nr r,z"Corrupt extra field %04x (size=%d)r)lÿÿÿÿr’z File sizez|_|r„d|_|jd O_|S|j|_|S) a_Construct an appropriate ZipInfo for a file on the filesystem. filename should be the path to a file or directory on the filesystem. arcname is the name which it will have within the archive (by default, this will be the same as filename, but without a drive letter and with leading path separators removed). rr"rxrwé;)r®rééé;r±Nrryrr))Ú isinstancer|ÚPathLikeÚfspathr‹ÚS_ISDIRÚst_modeÚtimeÚ localtimeÚst_mtimeÚpathÚnormpathÚ splitdriver}ÚaltseprorsÚst_size) ÚclsrBÚarcnamer­Ústr�ÚmtimerfÚzinforrrÚ from_fileÿs4      ÿ þzZipInfo.from_filecCs|jddkS)z2Return True if this archive member is a directory.éÿÿÿÿry©rBr©rrrr�%szZipInfo.is_dir)rvrw©N) rrrrÚ __slots__r„r‘r£r™r«Ú classmethodrÄr�rrrrr Qs , . %r cCs0tdƒD]}|d@r|d?dA}q|dL}q|S)Nrrl q[)Úrange)Úcrcr7rrrÚ_gen_crc/s  rÌcsld‰d‰d‰tdurttttdƒƒƒat‰‡fdd„‰‡‡‡‡fdd„‰|D]}ˆ|ƒq&‡‡fd d „}|S) NixV4i‰gE#i�xV4écs|d?ˆ||Ad@AS)z(Compute the CRC32 primitive on one byte.réÿr)ZchrË)ÚcrctablerrÚcrc32Isz_ZipDecrypter..crc32cs<ˆ|ˆƒ‰ˆˆd@d@‰ˆddd@‰ˆˆd?ˆƒ‰dS)NrÎr’i„rér)Úc)rÐÚkey0Úkey1Úkey2rrÚ update_keysMs z"_ZipDecrypter..update_keyscsNtƒ}|j}|D]}ˆdB}|||dAd?d@N}ˆ|ƒ||ƒqt|ƒS)zDecrypt a bytes object.rrrrÎ)Ú bytearrayr1Úbytes)rXrCr1rÒÚk)rÕrÖrrÚ decrypterWs z _ZipDecrypter..decrypter)Ú _crctabler`ÚmaprÌrÊ)ÚpwdÚprÚr)rÐrÏrÓrÔrÕrÖrÚ _ZipDecrypter?s   rßc@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) ÚLZMACompressorcCs d|_dSrÇ)Ú_compr©rrrr„gs zLZMACompressor.__init__cCsFt dtji¡}tjtjt tj|¡gd�|_t dddt |ƒ¡|S)NÚid©Úfilterszr\©rƒÚnrXrrrr>÷s  $øz_SharedFile.readcCs(|jdur|j}d|_| |¡dSdSrÇ)rr)rƒÚfileobjrrrr s ýz_SharedFile.closeN©r©rÅ)rrrr„r\rEr>r rrrrrás   rc@s4eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd S) Ú _TellablecCs||_d|_dS©Nr)r<rV©rƒr<rrrr„ s z_Tellable.__init__cCs|j |¡}|j|7_|SrÇ)r<ÚwriterV)rƒrXrrrrrs z_Tellable.writecCr rÇ)rVr©rrrr\r z_Tellable.tellcCó|j ¡dSrÇ)r<rër©rrrrëóz_Tellable.flushcCrrÇ)r<r r©rrrr rz_Tellable.closeN)rrrr„rr\rër rrrrr s  rcsªeZdZdZdZdZdZ  d(dd„Zd d „Zd d „Z d)dd„Z d*dd„Z dd„Z d)dd„Z dd„Zdd„Zdd„Zdd„Z‡fdd „Zd!d"„Zd+d$d%„Zd&d'„Z‡ZS),Ú ZipExtFilezZFile-like object for reading an archive member. Is returned by ZipFile.open(). i@iiNFcCs&||_||_||_|j|_|j|_|j|_t |jƒ|_ d|_ d|_ d|_ d|_||_|j|_t|dƒr=|j|_tdƒ|_nd|_d|_z| ¡r\| ¡|_|j|_|j|_|j|_d|_Wn tyfYnwd|_|r�|j d@ry|j!d?d@}n|jd?d@}| "¡}||kr‘t#d |j$ƒ‚dSdS) NFr-rrqTrrÎrÑzBad password for file %r)%Ú_fileobjÚ_pwdÚ_close_fileobjrgÚ_compress_typerrÚ_compress_leftrsÚ_leftrÿÚ _decompressorÚ_eofÚ _readbufferÚ_offsetÚnewlinesÚmoderBÚnamer@rqÚ _expected_crcrÐÚ _running_crcÚ _seekablerr\Ú_orig_compress_startÚ_orig_compress_sizeÚ_orig_file_sizeÚ_orig_start_crcÚAttributeErrorÚ _decrypterrlrtÚ_init_decrypterr÷re)rƒrr&ÚzipinforÝZ close_fileobjZ check_byteÚhrrrr„+sN    € ÿ ÷zZipExtFile.__init__cCs4t|jƒ|_|j d¡}|jd8_| |¡dS)Nrr&)rßrr0rr>r)rƒr¢rrrr1^s  zZipExtFile._init_decryptercCsvd|jj|jjfg}|js,| d|j|jf¡|jtkr+| dt   |j|j¡¡n| d¡| d¡d  |¡S)Nú<%s.%sz name=%r mode=%rr…ú [closed]r†r‡) rˆrrÚclosedr1r'r&rrr‰rŠr2©rƒrCrrrr‘isÿ ÿÿ€   zZipExtFile.__repr__rÅcCsL|dkr|j d|j¡d}|dkr|j|j|…}||_|Stj ||¡S)zrRead and return a line from the stream. If limit is specified, at most limit bytes will be read. ró r)r#rzr$ÚioÚBufferedIOBaseÚreadline)rƒÚlimitr6Úlinerrrr;wszZipExtFile.readlinercCsr|t|jƒ|jkr.| |¡}t|ƒ|jkr%||j|jd…|_d|_n |jt|ƒ8_|j|j|jd…S)z6Returns buffered bytes without advancing the position.Nri)r0r#r$r>)rƒrÚchunkrrrÚpeek‡s zZipExtFile.peekcCs|jrtdƒ‚dS)NúI/O operation on closed file.T)r6rr©rrrÚreadable”szZipExtFile.readablecCs"|jrtdƒ‚|dus|dkr-|j|jd…}d|_d|_|js+|| |j¡7}|jr |S||j}|t|jƒkrF|j|j|…}||_|S|t|jƒ}|j|jd…}d|_d|_|dkr�|js�| |¡}|t|ƒkr~||_||_||d|…7} |S||7}|t|ƒ8}|dkr�|jrb|S)zŽRead 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-)r6rr#r$r"Ú_read1ÚMAX_Nr0)rƒrÚbufÚendrXrrrr>™s>ÿ   þ ø zZipExtFile.readcCsD|jdurdSt||jƒ|_|jr|j|jkr td|jƒ‚dSdS)NzBad CRC-32 for file %r)r(rÐr)r"rr')rƒÚnewdatarrrÚ _update_crc¼s ÿzZipExtFile._update_crccCs|dus|dkr-|j|jd…}d|_d|_|js+| |j¡}|r(||7} |S|jr|S||j}|t|jƒkrF|j|j|…}||_|S|t|jƒ}|j|jd…}d|_d|_|dkrŠ|jsŠ| |¡}|t|ƒkr~||_||_||d|…7} |S|r‡||7} |S|jrb|S)z7Read up to n bytes with at most one read() system call.Nrr-)r#r$r"rBrCr0)rƒrrDrXrErrrÚread1ÆsH û   ýö zZipExtFile.read1cCs |js|dkr dS|jtkr$|jj}|t|ƒkr#|| |t|ƒ¡7}n| |¡}|jtkr5|jdk|_n<|jtkrat ||j ƒ}|j  ||¡}|jj pT|jdkoT|jj |_|jr`||j  ¡7}n|j  |¡}|jj po|jdk|_|d|j…}|jt|ƒ8_|jdkr‰d|_| |¡|S)Nrr-T)r"rrr!Zunconsumed_tailr0Ú_read2rrraÚ MIN_READ_SIZErðrïrër rGrrrrrBës8  €     þ€   zZipExtFile._read1cCsd|jdkrdSt||jƒ}t||jƒ}|j |¡}|jt|ƒ8_|s&t‚|jdur0| |¡}|S)Nrr-) rrarJÚminrr>r0ÚEOFErrorr0rrrrrIs      zZipExtFile._read2cs>z|jr|j ¡Wtƒ ¡dSWtƒ ¡dStƒ ¡wrÇ)rrr Úsuperr©©rˆrrr s  ýzZipExtFile.closecCs|jrtdƒ‚|jS©Nr@)r6rr*r©rrrr&szZipExtFile.seekablercCsJ|jrtdƒ‚|jst d¡‚| ¡}|dkr|}n|dkr#||}n|dkr-|j|}ntdƒ‚||jkr9|j}|dkr?d}||}||j}|dkrY|t|j ƒkrY||_d}n1|dkrŠ|j   |j ¡|j |_|j|_|j|_d|_ d|_t|jƒ|_d|_|}|jdurŠ| ¡|dkr¡t|j|ƒ}| |¡||8}|dksŽ| ¡S) Nzseek on closed file.ú!underlying stream is not seekablerrrzCwhence must be os.SEEK_SET (0), os.SEEK_CUR (1), or os.SEEK_END (2)r-F)r6rr*r9ÚUnsupportedOperationr\r-r$r0r#rrEr+r.r)r,rr rÿrr!r"r0r1rKÚ MAX_SEEK_READr>)rƒrVr Zcurr_posZnew_posZ read_offsetZ buff_offsetZread_lenrrrrE+sN         ýzZipExtFile.seekcCs>|jrtdƒ‚|jst d¡‚|j|jt|jƒ|j }|S)Nztell on closed file.rP) r6rr*r9rQr-r r0r#r$)rƒZfileposrrrr\]s  zZipExtFile.tell)NFr©rr)rrrrrCrJrRr„r1r‘r;r?rAr>rGrHrBrIr rrEr\Ú __classcell__rrrNrrs, ÿ3   # %$  2rcs@eZdZdd„Zedd„ƒZdd„Zdd„Z‡fd d „Z‡Z S) Ú _ZipWriteFilecCs8||_||_||_t|j|jƒ|_d|_d|_d|_ dSr) Ú_zinfoÚ_zip64Ú_zipfilerþrgrhÚ _compressorÚ _file_sizeÚ_compress_sizeÚ_crc)rƒÚzfrÃrœrrrr„gsÿ z_ZipWriteFile.__init__cCs|jjSrÇ)rXr<r©rrrrqsz_ZipWriteFile._fileobjcCsdS)NTrr©rrrÚwritableuóz_ZipWriteFile.writablecCs„|jrtdƒ‚t|ttfƒrt|ƒ}nt|ƒ}|j}|j|7_t ||j ƒ|_ |j r:|j   |¡}|j t|ƒ7_ |j |¡|SrO)r6rr²rØr×r0Ú memoryviewÚnbytesrZrÐr\rYrêr[rr)rƒrXrarrrrxs   z_ZipWriteFile.writec sf|jrdSz¨tƒ ¡|jr(|j ¡}|jt|ƒ7_|j |¡|j|j _ n|j |j _ |j |j _ |j |j _|j jd@r_|jrBdnd}|j t |t|j j |j j |j j¡¡|j ¡|j_n7|jst|j tkrktdƒ‚|jtkrttdƒ‚|j ¡|j_|j |j j¡|j |j  |j¡¡|j |jj¡|jj |j ¡|j |jj|j j<Wd|j_ dSd|j_ w)Nrzdd"œd#d$„Zd?d%d&„Zd@d'd(„ZdAd)d*„Zed+d,„ƒZd-d.„Zd/d0„Z  dAd1d2„Z d@d3d4„Z d5d6„Z!d7d8„Z"d9d:„Z#d;d<„Z$dS)Br 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. NFÚrTr¬c Cs@|dvrtdƒ‚t|ƒ||_d|_d|_i|_g|_||_||_||_ d|_ d|_ ||_ t |tjƒr8t |¡}t |tƒrpd|_||_ddd d dd d d œ}||} z t ||¡|_Wntym||vrl||}YqQ‚w n d|_||_t|ddƒ|_d|_t ¡|_d|_d|_z…|dkr—| ¡WdS|dvrÜd|_z|j  ¡|_!Wnt"tfy¿t#|jƒ|_d|_!d|_YWdSwz |j $|j!¡WWdSt"tfyÛd|_YWdSw|dk�r z| ¡|j $|j!¡WWdSt%�y |j $dd¡d|_|j  ¡|_!YWdSwtdƒ‚|j} d|_| &| ¡‚)z]Open the ZIP file with mode read 'r', write 'w', exclusive create 'x', or append 'a'.)rgÚwÚxÚaz+ZipFile requires mode 'r', 'w', 'x', or 'a'FrNr-r?úw+búx+búr+bÚwbZxb)rgrhrirjrmrkrlTrr'rg)rhrirjrz"Mode must be 'r', 'w', 'x', or 'a')'rrûÚ _allowZip64Ú _didModifyÚdebugrerdrúrýr&rÝÚ_commentÚ_strict_timestampsr²r|r³r´ÚstrÚ _filePassedrBr9rAr<r:ÚgetattrÚ _fileRefCntÚ threadingÚRLockrr*rÚ_RealGetContentsr\rcr/rrErÚ_fpclose) rƒrr&rúÚ allowZip64rýr­ZmodeDictrŒr<rrrr„Ös�   ÿ ü  ýÿ ù  zZipFile.__init__cCs|SrÇrr©rrrÚ __enter__0r_zZipFile.__enter__cCs | ¡dSrÇ©r )rƒÚtypeÚvalueÚ tracebackrrrÚ__exit__3ó zZipFile.__exit__cCs‚d|jj|jjfg}|jdur2|jr| d|j¡n |jdur)| d|j¡| d|j¡n| d¡| d¡d |¡S)Nr4z file=%rz filename=%rz mode=%rr5r†r‡) rˆrrr<rur1rBr&r2r7rrrr‘6sÿ     zZipFile.__repr__c CsØ|j}zt|ƒ}Wn tytdƒ‚w|stdƒ‚|jdkr$t|ƒ|t}|t}|t|_ |t ||}|jdkrI||}td|||ƒ|||_ |j dkrWtdƒ‚|  |j d¡|  |¡}t |¡}d}||k�rS|  t¡} t| ƒtkr~tdƒ‚t t| ¡} | ttkrŽtdƒ‚|jdkr—t| ƒ|  | t¡} | d } | d @r¬|  d ¡} n|  d ¡} t| ƒ} |  | t¡| _|  | t¡| _| t| _| dd …\ | _ | _!| _"| _#| _$| _%} }| _&| _'| _(| j"t)kròt*d| j"dƒ‚| dd…\| _+| _,| _-| | _.|d?d|d ?d@|d@| d?| d ?d@| d@df| _/|  0¡| j|| _|j1 2| ¡| |j3| j4<|t| t| t| t}|jdk�rOtd|ƒ||kso|j }t5|j1dd„dd�D] }||_6|j}�q`dS)z/Read in the table of contents for the ZIP file.zFile is not a zip filerrzgiven, inferred, offsetrz Bad offset for central directoryzTruncated central directoryz&Bad magic number for central directoryr!r¦r¥Úcp437rzzip file version %.1fr%r(r+r$rxr¯r&rÚtotalcSr rÇ)rp)rÃrrrÚ’óz*ZipFile._RealGetContents..T)ÚkeyÚreverseN)7r<r9r:rrqÚprintrRrSÚ _ECD_COMMENTrrrTrcrEr>r9ÚBytesIOÚsizeCentralDirr0rFr/ÚstructCentralDirÚ _CD_SIGNATUREÚstringCentralDirÚ_CD_FILENAME_LENGTHÚdecoder Ú_CD_EXTRA_FIELD_LENGTHr3Ú_CD_COMMENT_LENGTHrdÚ_CD_LOCAL_HEADER_OFFSETrprYrirjrkrlrgrqrrrsÚMAX_EXTRACT_VERSIONrùrmrnrortrfr«rdr1rerBÚsortedru)rƒr<rWZsize_cdZ offset_cdÚconcatZinferredrXr…ÚcentdirrBÚflagsriÚtÚdÚ end_offsetrÃrrrrzDs–  ÿ                 þ   ÿÿ   ÿþ  Ó/ þ üzZipFile._RealGetContentscCsdd„|jDƒS)z+Return a list of file names in the archive.cSsg|]}|j‘qSrrÆ)Ú.0rXrrrÚ ™sz$ZipFile.namelist..©rdr©rrrÚnamelist—szZipFile.namelistcCr )zJReturn a list of class ZipInfo instances for files in the archive.r r©rrrÚinfolist›ózZipFile.infolistcCsLtdd|d�|jD]}d|jdd…}td|j||jf|d�q dS)z+Print a table of contents for the zip file.z%-46s %19s %12s)z File Namez Modified ZSize)rz%d-%02d-%02d %02d:%02d:%02dNr"z %-46s %s %12d)rŠrdrfrBrs)rƒrrÃÚdaterrrÚprintdir sÿ ÿþzZipFile.printdirc Csxd}|jD]4}z$| |jd¡�}| |¡r | |¡sWdƒn1s%wYWqty9|jYSwdS)z%Read all the files and check the CRC.irgN)rdrArBr>r)rƒZ chunk_sizerÃÚfrrrÚtestzip©s   ÿ€ÿ€ ÿùzZipFile.testzipcCs$|j |¡}|durtd|ƒ‚|S)z,Return the instance of ZipInfo given 'name'.Nz(There is no item named %r in the archive)rerŠÚKeyError)rƒr'ÚinforrrÚgetinfo¶s ÿzZipFile.getinfocCs8|rt|tƒstdt|ƒjƒ‚|r||_dSd|_dS)z)Set default password for encrypted files.úpwd: expected bytes, got %sN)r²rØÚ TypeErrorrrrÝ)rƒrÝrrrÚ setpassword¿s   zZipFile.setpasswordcCr )z.The comment text associated with the ZIP file.)rrr©rrrrdÈr£zZipFile.commentcCs^t|tƒstdt|ƒjƒ‚t|ƒtkr'ddl}|jdtdd�|dt…}||_ d|_ dS)Nzcomment: expected bytes, got %srz3Archive comment is too long; truncating to %d bytesr©Ú stacklevelT) r²rØr¬rrr0ÚZIP_MAX_COMMENTÚwarningsÚwarnrrrp)rƒrdr±rrrrdÍs  ÿÿ  cCs:| |d|¡� }| ¡WdƒS1swYdS)zReturn file bytes for name.rgN©rAr>)rƒr'rÝr<rrrr>Ús$ÿz ZipFile.read©Ú force_zip64c s*|dvrtdƒ‚|rt|tƒstdt|ƒjƒ‚|r"|dkr"tdƒ‚ˆjs)tdƒ‚t|tƒr1|}n|dkrBt|ƒ}ˆj|_ ˆj |_ nˆ  |¡}|dkrRˆj ||d�SˆjrYtdƒ‚ˆjd 7_tˆj|jˆjˆj‡fd d „ƒ}zœ| t¡}t|ƒtkr€td ƒ‚t t|¡}|ttkr�td ƒ‚| |t¡}|tr¢| |t¡|jd@r«t dƒ‚|jd@r´t dƒ‚|t!d@rÀ| "d¡} n| "d¡} | |j#krÓtd|j#|fƒ‚|j$durë| %¡|j&|j$krëtd|j#›d�ƒ‚|jd @} | �r|søˆj'}|�st(d|ƒ‚nd}t)||||dƒWS| *¡‚)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. >rgrhzopen() requires mode "r" or "w"r«rhz'pwd is only supported for reading filesz2Attempt to use ZIP archive that was already closedr´rrcsˆjSrÇ)rrr©rrr†r‡zZipFile.open..zTruncated file headerz Bad magic number for file headeré z$compressed patched data (flag bit 5)é@zstrong encryption (flag bit 6)r¦r¥r„z/File name in directory %r and header %r differ.NzOverlapped entries: z (possible zip bomb)z6File %r is encrypted, password required for extractionT)+rr²rØr¬rrr<r rúrgrýrhrªÚ_open_to_writerrwrrpr{rr>ÚsizeFileHeaderr0rrFr/ršÚ _FH_SIGNATUREr›Ú_FH_FILENAME_LENGTHÚ_FH_EXTRA_FIELD_LENGTHrlrùÚ_FH_GENERAL_PURPOSE_FLAG_BITSr’rerur\rrrÝr÷rr ) rƒr'r&rÝrµrÃZzef_fileZfheaderÚfnameZ fname_strZ is_encryptedrr©rrAßs‚ ÿ    ÿ          ÿÿ  ÿÿz ZipFile.opencCsÖ|r |js tdƒ‚|jrtdƒ‚d|_d|_d|_|jtkr%|jdO_|js/|jdO_|j s5d|_ |jo@|p@|j dt k}|jrK|j   |j¡|j  ¡|_| |¡d|_|j  | |¡¡d|_t|||ƒS) NzHforce_zip64 is True, but allowZip64 was False when opening the ZIP file.zzCan't write to the ZIP file while there is another write handle open on it. Close the first handle before opening another.rrré€gÍÌÌÌÌÌð?T)rorrrrrqrlrgrr*rorsr“r<rErcr\rpÚ _writecheckrprr£rU)rƒrÃrµrœrrrr¸Es4 ÿ ÿ   zZipFile._open_to_writecCs*|dur t ¡}nt |¡}| |||¡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'. N)r|Úgetcwdr´Ú_extract_member)rƒÚmemberrºrÝrrrÚextractns  zZipFile.extractcCsH|dur| ¡}|durt ¡}nt |¡}|D] }| |||¡qdS)zõExtract 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¡r|rÁr´rÂ)rƒrºÚmembersrÝr2rrrÚ extractall{s  ÿzZipFile.extractallcCs^|j}|sd}t |dt|ƒ¡}||_| |¡}dd„| |¡Dƒ}| dd„|Dƒ¡}|S)z;Replace bad characters and remove trailing dots from parts.z:<>|"?*Ú_css�|]}| d¡VqdS)Ú.N)Úrstrip©ržrirrrÚ –ó€z1ZipFile._sanitize_windows_name..css�|]}|r|VqdSrÇrrÊrrrr˘s€)Ú!_windows_illegal_name_trans_tablertÚ maketransr0Ú translateÚsplitr2)r¿rÀÚpathsepÚtableZillegalrrrÚ_sanitize_windows_nameŒs zZipFile._sanitize_windows_namec sðt|tƒs | |¡}|j}tjjdkr| dtjj¡}tjjr/tjjdkr/| tjjtjj¡}tj  |¡\}}|j rE|sC|  tjj¡rEdS|j rUtjj |  tjj¡vrUdSdtjjtjj f‰tjj ‡fdd„|  tjj¡Dƒ¡}tjjdkrŠ| |tjj¡}|j rˆ||krˆdS|}tj ||¡}tj |¡}tj |¡}|rªtj |¡sªt |¡| ¡r»tj |¡s¹t |¡|S|j||d��,}t|dƒ�} t || ¡Wdƒn1sÙwYWdƒ|SWdƒ|S1sñwY|S) zbExtract the ZipInfo object 'member' to a physical file on the path targetpath. ryNr‡c3s�|] }|ˆvr|VqdSrÇrrÊ©Zinvalid_path_partsrrr˱s €ÿÿz*ZipFile._extract_member..ú\©rÝrn)r²r rªrBr|rºr}r~r½r¼Ú_ignore_invalid_namesrJÚpardirrÐÚcurdirr2rÓr»ÚdirnameÚexistsÚmakedirsr�r�ÚmkdirrAÚshutilÚ copyfileobj) rƒrÃZ targetpathrÝrÀZdriveZarcname2Z upperdirsÚsourceÚtargetrrÔrr›sN   &      ÿ(þ üüzZipFile._extract_membercCs¦|j|jvrddl}|jd|jdd�|jdvrtdƒ‚|js$tdƒ‚t|jƒ|j sOd}t |j ƒt kr8d }n|j tkr@d }n|jtkrGd }|rQt|d ƒ‚dSdS) z6Check for errors before writing a file to the archive.rNzDuplicate name: %rrr®©rhrirjz&write() requires mode 'w', 'x', or 'a'z4Attempt to write ZIP archive that was already closedú Files countZFilesizez Zipfile sizeú would require ZIP64 extensions)rBrer±r²r&rr<rûrgror0rdÚZIP_FILECOUNT_LIMITrsr“rpr )rƒrÃr±Úrequires_zip64rrrrÀÍs0  ÿ   ÿ÷zZipFile._writecheckc Cs |jstdƒ‚|jrtdƒ‚tj|||jd�}| ¡r"d|_d|_n|dur*||_ n|j |_ |dur6||_ n|j |_ | ¡r“|j �H|jrL|j |j¡|j ¡|_|j tkr^|jdO_| |¡d|_|j |¡||j|j<|j | d¡¡|j ¡|_WdƒdS1sŒwYdSt|d ƒ�.}| |d ¡�}t ||d ¡Wdƒn1s±wYWdƒdSWdƒdS1sÉwYdS) 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 existsr¬rNrTFr?rhi ) r<rrr rÄrsr�rrrqrgrúrhrýrr*rErcr\rprrlrÀrprdr1rerBrr£rArÞrß)rƒrBrÀrgrýrÃÚsrcÚdestrrrräsJÿÿÿ     "òPÿz ZipFile.writec Cs2t|tƒr | d¡}t|tƒss zZipFile.__del__c Csø|jdurdS|jrtdƒ‚za|jdvrF|jrT|j�|jr%|j |j¡|  ¡Wdƒn21s3wYW|j}d|_|  |¡dSW|j}d|_|  |¡dSW|j}d|_|  |¡dSW|j}d|_|  |¡dS|j}d|_|  |¡w)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â) r<rrr&rprr*rErcÚ_write_end_recordr{rrrrr Bs:  ýøøùþ z ZipFile.closecCs|jD]ç}|j}|ddd>|dd>B|dB}|dd>|d d>B|ddB}g}|jtks8|jtkrI| |j¡| |j¡d }d }n|j}|j}|jtkr]| |j¡d }n|j}|j} d} |r…t| d ƒ} t j d d t |ƒddt |ƒg|¢RŽ| } t } |j tkr�tt| ƒ} n |j tkrštt| ƒ} t| |jƒ} t| |jƒ} | ¡\} }t   tt| |j| |j||j |||j||t | ƒt | ƒt |jƒd|j|j|¡}|j |¡|j | ¡|j | ¡|j |j¡q|j  ¡}t |jƒ}||j!}|j!}d}|t"k�rd}n|tk�rd}n|tk�rd}|�rX|j#�s#t$|dƒ‚t   t%t&t'ddddd||||¡ }|j |¡t   t(t)d|d¡}|j |¡t*|dƒ}t*|d ƒ}t*|d ƒ}t   t+t,dd||||t |j-ƒ¡ }|j |¡|j |j-¡|j.dk�r€|j /¡|j 0¡dS)Nrrxr$rr!rrr&r r’rSr,ÚQrrãzCentral directory offsetzCentral directory sizerärrrrj)1rdrfrsr“rrr1rpr3r8rFr”r0r–rgrrar—rr˜rjrYr™rŽr�rirkrqrdrnror<rr\rcråror rLrKrIrGrHrKr_r^rrr&Útruncaterë)rƒrÃr�ržrŸr3rsrrrpZ extra_datar rjrYrBrlr™Zpos2Z centDirCountZ centDirSizeZ centDirOffsetræZ zip64endrecZ zip64locrecrWrrrrìXs² $$        þþþ          ù         ÿý þ     þ   zZipFile._write_end_recordcCs<|jdksJ‚|jd8_|js|js| ¡dSdSdS)Nrr)rwrur rrrrr{¶s   ÿzZipFile._fpcloserÇ)rgN)F)NN)NNN)%rrrrr<rÍr×rr„r}r‚r‘rzr¡r¢r¥r§rªr­rfrdÚsetterr>rAr¸rÄrÆrÉrÓrÂrÀrrêrër rìr{rrrrr »sTÿ ÿZS        f )  2 ÿ2 ÿ) ^r c@s4eZdZdZdeddfdd„Zd d d „Zd d „ZdS)r zDClass to create ZIP archives with Python library files and packages.rgTrÅcCstj|||||d�||_dS)N)r&rúr|)r r„Ú _optimize)rƒrr&rúr|Úoptimizerrrr„Às ÿ zPyZipFile.__init__r‡NcCs®t |¡}|r"||ƒs"|jr tj |¡rdnd}td||fƒdStj |¡\}}tj |¡�r-tj |d¡}tj |¡r×|rGd||f}n|}|jrStd|d|ƒ|  |d d …|¡\}} |jrgtd | ƒ|  || ¡t t  |¡ƒ} |   d¡| D]Y} tj || ¡} tj | ¡\} }tj | ¡r¦tj tj | d¡¡r¥|j| ||d �q{|d krÔ|rº|| ƒsº|jr¹td| ƒq{|  | d d …|¡\}} |jrÎtd | ƒ|  || ¡q{dS|jrßtd|ƒt t  |¡ƒD]D} tj || ¡} tj | ¡\} }|d k�r*|�r|| ƒ�s|j�rtd| ƒqæ|  | d d …|¡\}} |j�r$td | ƒ|  || ¡qædS|d d…d k�r:tdƒ‚|  |d d …|¡\}} |j�rOtd| ƒ|  || ¡dS)a¦Add 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. rºrz%s %r skipped by filterfuncNz __init__.pyú%s/%szAdding package inÚasréýÿÿÿZAdding)Ú filterfuncú.pyzfile %r skipped by filterfunczAdding files from directoryz.Files added with writepy() must end with ".py"z Adding file)r|r´rqrºr�rŠrÐr2ÚisfileÚ _get_codenamerr—ÚlistdirÚremoveÚsplitextÚwritepyr÷)rƒÚpathnameÚbasenamerõZlabelÚdirr'Zinitnamer¾rÀZdirlistrBrºÚrootZextrrrrüÆsŠ       ÿ€  ÿ  €ï   ÿ  €ôÿ zPyZipFile.writepyc sþd‡fdd„ }|d}|d}tjj|dd�}tjj|dd�}tjj|d d�}ˆjdkr¨tj |¡rCt |¡jt |¡jkrC|} } n¨tj |¡rZt |¡jt |¡jkrZ|} |} n‘tj |¡rqt |¡jt |¡jkrq|} |} nztj |¡rˆt |¡jt |¡jkrˆ|} |} nc||ƒr£t j j d kr•|} n t j j dkrž|} n|} |} nH|} } nCˆjd kr²|} |} n|} ˆjdkr¼|} nˆjd krÄ|} n d   ˆj¡} t | ƒ‚tj | ¡ràt | ¡jt |¡jksë||ˆjd �së|} } tj | ¡d} |rûd || f} | | fS)aReturn (filename, archivename) for the path. Given a module name path, return the correct file path and archive name, compiling if necessary. For example, given /python/lib/string, return (/python/lib/string.pyc, string). rÅc sbddl}ˆjr td|ƒz |j|d|d�WdS|jy0}z t|jƒWYd}~dSd}~ww)NrZ CompilingT)ÚdoraiserñF)Ú py_compilerqrŠÚcompileÚPyCompileErrorÚmsg)rrñrÚerrr©rrÚ_compiles ý €þz)PyZipFile._get_codename.._compileröz.pycr‡)Ú optimizationrrrz"invalid value for 'optimize': {!r})rñròNr)Ú importlibÚutilÚcache_from_sourcerðr|rºr÷r‹r¹r€ršrñÚformatrrÐ) rƒrýrþrZfile_pyZfile_pycZ pycache_opt0Z pycache_opt1Z pycache_opt2rÀr¾rZ archivenamerr©rrøs`                zPyZipFile._get_codename)r‡N)rrrrrr„rürørrrrr ½s ÿ  Rr cCst t|ƒdd¡S)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('')) [] rN)Ú itertoolsÚisliceÚ _ancestry)rºrrrÚ_parentsksrccsB�| tj¡}| tj¡r|Vt |¡\}}| tj¡s 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)rÉÚ posixpathr}rÐ)rºÚtailrrrr~s €  þrcCst t|ƒj|¡S)zZ Return items in minuend not in subtrahend, retaining order with O(1) lookup. )r Ú filterfalseÚsetÚ __contains__)ZminuendZ subtrahendrrrÚ _difference�srcsTeZdZdZedd„ƒZ‡fdd„Zdd„Zdd „Z‡fd d „Z e d d „ƒZ ‡Z S)Ú CompleteDirszk A ZipFile subclass that ensures that implied directories are always included in the namelist. cCs.tj tt|ƒ¡}dd„|Dƒ}tt||ƒƒS)Ncss�|]}|tjVqdSrÇ)rr})ržrÞrrrrË®rÌz-CompleteDirs._implied_dirs..)r ÚchainÚ from_iterablerÜrÚ_deduper)ÚnamesÚparentsZas_dirsrrrÚ _implied_dirs«szCompleteDirs._implied_dirscs tt|ƒ ¡}|t| |¡ƒSrÇ)rMrr¡r`r)rƒrrNrrr¡±szCompleteDirs.namelistcCs t| ¡ƒSrÇ)rr¡r©rrrÚ _name_setµrƒzCompleteDirs._name_setcCs,| ¡}|d}||vo||v}|r|S|S)zx If the name represents a directory, return that name as a directory (with the trailing slash). ry)r)rƒr'rrÚZ dir_matchrrrÚ resolve_dir¸s zCompleteDirs.resolve_dircsDztƒ |¡WSty!| d¡r|| ¡vr‚t|d�YSw)z6 Supplement getinfo for implied dirs. ryrÆ)rMrªr¨Úendswithrr )rƒr'rNrrrªÂs ýzCompleteDirs.getinfocCs8t|tƒr|St|tƒs||ƒSd|jvrt}||_|S)zl Given a source (filename or zipfile), return an appropriate CompleteDirs subclass. rg)r²rr r&rˆ)r¿ràrrrÚmakeÍs   zCompleteDirs.make) rrrrÚ staticmethodrr¡rrrªrÉr!rTrrrNrr¥s    rcs,eZdZdZ‡fdd„Z‡fdd„Z‡ZS)Ú FastLookupzV ZipFile subclass to ensure implicit dirs exist and are resolved rapidly. cóFt t¡� |jWdƒS1swYtt|ƒ ¡|_|jSrÇ)Ú contextlibÚsuppressr/Z_FastLookup__namesrMr#r¡r©rNrrr¡çó  ÿzFastLookup.namelistcr$rÇ)r%r&r/Z_FastLookup__lookuprMr#rr©rNrrrír'zFastLookup._name_set)rrrrr¡rrTrrrNrr#ás r#cOst |d¡||fS)Nr)r9Ú text_encoding)ÚencodingÚargsÚkwargsrrrÚ_extract_text_encodingôsr,c@s®eZdZdZdZd'dd„Zd(ddœd d „Zed d „ƒZed d„ƒZ dd„Z dd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„ZeZed%d&„ƒZdS))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})r‡cCst |¡|_||_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)r#r!rÚat)rƒrr-rrrr„I s z Path.__init__rgNrÖcOsŽ| ¡rt|ƒ‚|d}| ¡s|dkrt|ƒ‚|jj|j||d�}d|vr0|s*|r.tdƒ‚|St|i|¤Ž\}}}t j ||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(). rrgrÖÚbz*encoding args invalid for binary operation) r�ÚIsADirectoryErrorrÛÚFileNotFoundErrorrrAr-rr,r9Ú TextIOWrapper)rƒr&rÝr*r+Zzip_modeÚstreamr)rrrrAV sz Path.opencCst |j¡jp |jjSrÇ)ÚpathlibZ PurePosixPathr-r'rBr©rrrr'j óz Path.namecCst |jj¡ |j¡SrÇ)r3rrrBÚjoinpathr-r©rrrrBn r4z Path.filenamecOsZt|i|¤Ž\}}}|jd|g|¢Ri|¤Ž� }| ¡WdƒS1s&wYdS)Nrg)r,rAr>)rƒr*r+r)ÚstrmrrrÚ read_textr s$ÿzPath.read_textcCs6| d¡� }| ¡WdƒS1swYdS)Nr?r³)rƒr6rrrÚ read_bytesw s $ÿzPath.read_bytescCst |j d¡¡|j d¡kS©Nry)rrÚr-rÉ)rƒrºrrrÚ _is_child{ szPath._is_childcCs| |j|¡SrÇ)rˆr)rƒr-rrrÚ_next~ rz Path._nextcCs|j p |j d¡Sr9)r-r r©rrrr�� sz Path.is_dircCs| ¡o| ¡ SrÇ)rÛr�r©rrrÚis_file„ óz Path.is_filecCs|j|j ¡vSrÇ)r-rrr©rrrrÛ‡ sz Path.existscCs.| ¡stdƒ‚t|j|j ¡ƒ}t|j|ƒS)NzCan't listdir a file)r�rrÜr;rr¡Úfilterr:)rƒZsubsrrrÚiterdirŠ s z Path.iterdircCst |jj|j¡SrÇ)rr2rrBr-r©rrrÚ__str__� r=z Path.__str__cCs|jj|d�S)Nr©)Ú _Path__reprr r©rrrr‘“ rz Path.__repr__cGs&tj|jg|¢RŽ}| |j |¡¡SrÇ)rr2r-r;rr)rƒÚotherÚnextrrrr5– sz Path.joinpathcCs6|js|jjSt |j d¡¡}|r|d7}| |¡Sr9)r-rBÚparentrrÚrÉr;)rƒZ parent_atrrrrDœ s  z Path.parent)r‡)rg)rrrrrAr„rArfr'rBr7r8r:r;r�r<rÛr?r@r‘r5Ú __truediv__rDrrrrrùs.M    rc s ddl}d}|j|d�}|jdd�}|jdddd d �|jd d d ddd�|jdddddd�|jddddd �| |¡}|jdurm|j}t|dƒ� }| ¡}Wdƒn1sYwY|rgtd  |¡ƒtdƒdS|j dur‘|j }t|dƒ� }|  ¡WdƒdS1sŠwYdS|j dur¸|j \}}t|dƒ�}|  |¡WdƒdS1s±wYdS|jdu�r|j d¡} |j} ‡fdd„‰t| dƒ�1}| D]%} tj | ¡} | sétj tj | ¡¡} | dtjtjfvrôd} ˆ|| | ƒqÕWdƒdS1�swYdSdS) Nrz3A simple command-line interface for zipfile module.)Ú descriptionT)Zrequiredz-lz--listú zShow listing of a zipfile)ÚmetavarÚhelpz-ez --extractr)rGz zExtract zipfile into target dir)ÚnargsrHrIz-cz--createú+)zzzCreate zipfile from sourcesz-tz--testzTest if a zipfile is validrgz.The following enclosed file is corrupted: {!r}z Done testingcsvtj |¡r| ||t¡dStj |¡r7|r| ||¡tt |¡ƒD]}ˆ|tj ||¡tj ||¡ƒq$dSdSrÇ) r|rºr÷rrr�r—rùr2)r]rºÚzippathZnm©ÚaddToZiprrrNÎ s   ÿüzmain..addToZiprhr‡)ÚargparseÚArgumentParserZadd_mutually_exclusive_groupÚ add_argumentÚ parse_argsÚtestr r§rŠr r`r¥rÄrÆZcreateÚpopr|rºrþrÚrÙrØ) r*rOrFÚparserÚgrouprèr]ZbadfilerÙZzip_nameÚfilesrºrLrrMrÚmain¦ sh   ÿ þ þ ÿ    ÿ    "ÿ    "ÿ     ú$ÿñrXÚ__main__rÇ)‘rZbinasciiÚimportlib.utilr r9r r|rÚrerÞr‹rFr€rxr·r%r3rörÐÚ ImportErrorrøråÚ__all__Ú Exceptionrr rrr“rår°rrrrr‚r–r—r˜r–r_r^r•r]rMrNrOrPrQrRrSrcr‹rTrŽr�r�r�Z_CD_CREATE_VERSIONZ_CD_CREATE_SYSTEMZ_CD_EXTRACT_VERSIONZ_CD_EXTRACT_SYSTEMZ _CD_FLAG_BITSZ_CD_COMPRESS_TYPEZ_CD_TIMEZ_CD_DATEZ_CD_CRCZ_CD_COMPRESSED_SIZEZ_CD_UNCOMPRESSED_SIZEr‘r“r”Z_CD_DISK_NUMBER_STARTZ_CD_INTERNAL_FILE_ATTRIBUTESZ_CD_EXTERNAL_FILE_ATTRIBUTESr•ršr›r¹rºZ_FH_EXTRACT_VERSIONZ_FH_EXTRACT_SYSTEMr½Z_FH_COMPRESSION_METHODZ_FH_LAST_MOD_TIMEZ_FH_LAST_MOD_DATEZ_FH_CRCZ_FH_COMPRESSED_SIZEZ_FH_UNCOMPRESSED_SIZEr»r¼rGrHrDrLrKrIZ_CD64_SIGNATUREZ_CD64_DIRECTORY_RECSIZEZ_CD64_CREATE_VERSIONZ_CD64_EXTRACT_VERSIONZ_CD64_DISK_NUMBERZ_CD64_DISK_NUMBER_STARTZ_CD64_NUMBER_ENTRIES_THIS_DISKZ_CD64_NUMBER_ENTRIES_TOTALZ_CD64_DIRECTORY_SIZEZ_CD64_OFFSET_START_CENTDIRrbZStructr.r8r=r rZr9Úobjectr rÛrÌrßràrìr‰rûrþrÿrrr:rrUr r rrÚdictÚfromkeysrrrr#r,rrXrrrrrÚsˆ   þ  ÿ  ÿ       <<^&ÿþýüûúùø ÷ ö õ ô óòñðï (KU/<  . = ÿ