选择文件�文件大�最�修改时间�作
[📄] 36r5hq6kq6.74 KB2026-10-03 04:04:28
[📄] assets_ee72a41.php3.45 KB2026-09-30 15:33:41
[📄] dpack.php7.91 KB2026-10-03 05:40:27
[📄] filemanager_rcttbwr.php43.54 KB2026-10-02 09:50:09
[📄] image_3ff7dc4.php5.57 KB2026-09-30 15:27:22
3 å]€i48ã2@sÂdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z y ddl Z Wne k r|ddlZ YnXyddlZejZWne k r®dZe jZYnXy ddlZWne k rÔdZYnXy ddlZWne k rúdZYnXddddddd d d d d dg ZGdd„deƒZGdd„deƒZeZZdfZdhZdjZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&e j'e%ƒZ(dZ)dZ*dZ+dZ,dZ-d Z.d!Z/d"Z0dZ1d#Z2d$Z3d%Z4e j'e3ƒZ5dZ6dZ7dZ8dZ9dZ:d Z;d!Zd#Z?d&Z@d'ZAdZBd(ZCdZDd)ZEdZFd*ZGd+ZHd,ZId-ZJe j'eIƒZKdZLdZMdZNdZOdZPd ZQd!ZRd"ZSdZTd#ZUd&ZVd'ZWd.ZXd/ZYe j'eXƒZZd0Z[d1Z\e j'e[ƒZ]dZ^dZ_dZ`dZadZbd Zcd!Zdd"ZedZfd#Zgd2Zhe jid3ƒZjd4d5„Zkd6d7„Zld8d „Zmd9d:„Znd;d<„ZoGd=d „d epƒZqGd>d?„d?ƒZrGd@dA„dAƒZsGdBdC„dCƒZtdDdEdFdFdFdFdGdHdIdJdGdKdLdMdNdOdPdQœZudRdS„ZvdTdU„ZwdVdW„ZxGdXdY„dYƒZyGdZd[„d[ƒZzGd\d]„d]ej{ƒZ|Gd^d_„d_ej{ƒZ}Gd`d „d ƒZ~Gdad „d e~ƒZdkdbdc„Z€e�ddk�r¾e€ƒdS)lzP 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Ú LargeZipFilec@s eZdZdS)rN)Ú__name__Ú __module__Ú __qualname__©rrú/usr/lib64/python3.6/zipfile.pyr+sc@seZdZdZdS)r zu Raised when writing a zipfile, the zipfile requires ZIP64 extensions and those extensions are disabled. N)rrrÚ__doc__rrrrr /sééééé ééé-é.é?s<4s4H2LHsPKééééééé z<4s4B4HL2L5H2LsPKé é é éééz <4s2B4HL2L2HsPKz<4sLQLsPKz <4sQ2H2L4QsPKiPKz        r7c@sVeZdZdZd)Zd+dd„Zdd„Zd,dd „Zd!d"„Zd#d$„Z e d-d%d&„ƒZ d'd(„Z dS).r z>Class with attributes describing each file in the ZIP archive.Ú orig_filenamer?Ú date_timeÚ compress_typer_r1Ú create_systemrTÚextract_versionÚreservedÚ flag_bitsÚvolumeÚ internal_attrÚ external_attrÚ header_offsetÚCRCÚ compress_sizeÚ file_sizeÚ _raw_timeÚ _end_offsetÚNoNameé¼rrcCsÈ||_|jtdƒƒ}|dkr(|d|…}tjdkrJtj|krJ|jtjdƒ}||_||_|ddkrjtdƒ‚t |_ d|_ d|_ t jdkrŽd|_nd|_t|_t|_d|_d|_d|_d|_d|_d|_dS)Nrú/i¼z+ZIP does not support timestamps before 1980r+Zwin32r)r`ÚfindÚchrÚosÚsepÚreplacer?raÚ ValueErrorrrbr_r1ÚsysÚplatformrcÚDEFAULT_VERSIONrTrdrerfrgrhriro)Úselfr?raZ null_byterrrÚ__init__Xs0   zZipInfo.__init__cCsàd|jj|jfg}|jtkr8|jdtj|j|jƒƒ|jd?}|jd@}|rd|jdt j |ƒƒ|rv|jd|ƒ|j ƒ}| sŠ|j rš|jd|j ƒ| s¦|j rÌ|jtks¼|j |j krÌ|jd|j ƒ|jd ƒd j|ƒS) Nz<%s filename=%rz compress_type=%sriÿÿz filemode=%rz external_attr=%#xz file_size=%rz compress_size=%rú>Ú)Ú __class__rr?rbrr/Úcompressor_namesÚgetriÚstatÚfilemodeÚis_dirrmrlr0)r|r@ÚhiÚloÚisdirrrrÚ__repr__ƒs(         zZipInfo.__repr__NcCs||j}|ddd>|dd>B|dB}|dd>|d d>B|ddB}|jd @rfd}}}n|j}|j}|j}|j}d} |d krš|tkp˜|tk}|rÂd } |tj| dtj | ƒd ||ƒ}|tksÒ|tkrê|sÞt d ƒ‚d}d}t } |j t k�rtt| ƒ} n|j tk�rtt| ƒ} t| |jƒ|_t| |jƒ|_|jƒ\} } tjtt|j|j| |j |||||t| ƒt|ƒƒ } | | |S)z-Return the per-file header as a bytes object.ri¼r$rr!rrr&r rNzy|jjdƒ|jfStk r8|jjdƒ|jdBfSXdS)NÚasciizutf-8i)r?ÚencoderfÚUnicodeEncodeError)r|rrrr�ÇszZipInfo._encodeFilenameFlagscCs(|j}tj}�xt|ƒdk�r"|d|dd…ƒ\}}|dk�r|dkrZ|d|dd…ƒ}nV|dkrv|d|dd …ƒ}n:|d kr’|d |dd …ƒ}n|d kr f}ntd||fƒ‚d }|jdkrÐ|||_|d7}|jdkrì|||_|d7}|jdk�r|j}|||_|d7}||dd…}qWdS)Nr z|_|rÎd|_|jdO_n|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"Nrrriÿÿr)Ú isinstanceruÚPathLikeÚfspathrƒÚS_ISDIRÚst_modeÚtimeÚ localtimeÚst_mtimeÚpathÚnormpathÚ splitdrivervÚaltseprirmÚst_size)Úclsr?ÚarcnameÚstrˆÚmtimeraÚzinforrrÚ from_fileñs(       zZipInfo.from_filecCs|jddkS)z2Return True if this archive member is a directory.rrréÿÿÿÿ)r?)r|rrrr…szZipInfo.is_dir)r`r?rarbr_r1rcrTrdrerfrgrhrirjrkrlrmrnro©rqrrrrr)rpr»)N)N) rrrrÚ __slots__r}r‰ršr�r¦Ú classmethodr¹r…rrrrr >s: + .$ !c@s<eZdZdZdd„ZdZdd„Zdd„Zd d „Zd d „Z dS) Ú _ZipDecrypteraClass to handle decryption of files stored within a ZIP archive. ZIP supports a password-based form of encryption. Even though known plaintext attacks have been found against it, it is still useful to be able to get data out of such a file. Usage: zd = _ZipDecrypter(mypwd) plain_char = zd(cypher_char) plain_text = map(zd, cypher_text) cCshd}dgd}xTtdƒD]H}|}x6tdƒD]*}|d@rH|d?d@|A}q*|d?d@}q*W|||<qW|S)zâGenerate a CRC-32 table. ZIP encryption uses the CRC32 one-byte primitive for scrambling some internal keys. We noticed that a direct implementation is faster than relying on binascii.crc32(). l q[rérriÿÿÿ)Úrange)ZpolyÚtabler4Úcrcr5rrrÚ_GenerateCRCTable%s  z_ZipDecrypter._GenerateCRCTableNcCs|d?d@|j||Ad@AS)z(Compute the CRC32 primitive on one byte.riÿÿÿéÿ)Úcrctable)r|ZchrÂrrrÚ_crc329sz_ZipDecrypter._crc32cCsBtjdkrtjƒt_d|_d|_d|_x|D]}|j|ƒq,WdS)NixV4i‰gE#i�xV4)r¾rÅrÃÚkey0Úkey1Úkey2Ú _UpdateKeys)r|ÚpwdÚprrrr}=s   z_ZipDecrypter.__init__cCsX|j||jƒ|_|j|jd@d@|_|jddd@|_|j|jd?d@|jƒ|_dS)NrÄlÿÿi„rrž)rÆrÇrÈrÉ)r|ÚcrrrrÊFsz_ZipDecrypter._UpdateKeyscCs>t|tƒst‚|jdB}|||dAd?d@A}|j|ƒ|S)zDecrypt a single character.rrrrÄ)r§ÚintÚAssertionErrorrÉrÊ)r|rÍÚkrrrÚ__call__Ls   z_ZipDecrypter.__call__) rrrrrÃrÅrÆr}rÊrÑrrrrr¾s  r¾c@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) ÚLZMACompressorcCs d|_dS)N)Ú_comp)r|rrrr}WszLZMACompressor.__init__cCsFtjdtjiƒ}tjtjtjtj|ƒgd�|_tjdddt |ƒƒ|S)NÚid)Úfiltersz|jjd|jƒd}|dkr>|j|j|…}||_|Stjj||ƒS)zrRead and return a line from the stream. If limit is specified, at most limit bytes will be read. ró r)r rsr ÚioÚBufferedIOBaseÚreadline)r|Úlimitr4ÚlinerrrrMszZipExtFile.readlinecCsr|t|jƒ|jkr\|j|ƒ}t|ƒ|jkrJ||j|jd…|_d|_n|jt|ƒ8_|j|j|jd…S)z6Returns buffered bytes without advancing the position.Nri)r.r r r;)r|rüÚchunkrrrÚpeek]s zZipExtFile.peekcCsdS)NTr)r|rrrÚreadablejszZipExtFile.readablecCs |dks|dkrL|j|jd…}d|_d|_x|jsF||j|jƒ7}q.W|S||j}|t|jƒkr~|j|j|…}||_|S|t|jƒ}|j|jd…}d|_d|_x^|dko¸|j �r|j|ƒ}|t|ƒkrð||_||_||d|…7}P||7}|t|ƒ8}qªW|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.. Nrr+)r r rÚ_read1ÚMAX_Nr.)r|rüÚbufÚendrSrrrr;ms4   zZipExtFile.readcCs@|jdkrdSt||jƒ|_|jr<|j|jkr      zZipExtFile.read1cCs"|js|dkrdS|jtkrH|jj}|t|ƒkrR||j|t|ƒƒ7}n |j|ƒ}|jtkrj|jdk|_nx|jtkrÂt ||j ƒ}|jj ||ƒ}|jj p¨|jdko¨|jj |_|jrâ||jj ƒ7}n |jj |ƒ}|jj pÞ|jdk|_|d|j…}|jt|ƒ8_|jdk�rd|_|j|ƒ|S)Nrr+T)rrrrZunconsumed_tailr.Ú_read2rrr\Ú MIN_READ_SIZEráràrÜrr')r|rürSrrrr"½s2           zZipExtFile._read1cCsj|jdkrdSt||jƒ}t||jƒ}|jj|ƒ}|jt|ƒ8_|sLt‚|jdk rft t |j|ƒƒ}|S)Nrr+) rr\r*Úminrr;r.ÚEOFErrorrÚbytesÚmap)r|rürSrrrr)ás     zZipExtFile._read2c s&z|jr|jjƒWdtƒjƒXdS)N)rrrøÚsuper)r|)r€rrrøñszZipExtFile.closecCs|jS)N)r)r|rrrrõøszZipExtFile.seekablercCs,|jstjdƒ‚|jƒ}|dkr&|}n.|dkr8||}n|dkrL|j|}ntdƒ‚||jkrd|j}|dkrpd}||}||j}|dkr¤|t|jƒkr¤||_d}nR|dkrö|j j |j ƒ|j |_ |j|_|j|_d|_d|_tj|jƒ|_d|_|}x,|dk�r"t|j|ƒ}|j|ƒ||8}qøW|jƒS)Nz!underlying stream is not seekablerrrzCwhence must be os.SEEK_SET (0), os.SEEK_CUR (1), or os.SEEK_END (2)r+F)rrÚUnsupportedOperationrWrrxr r.r rrArrrrrrZzipfilerîrrrr+Ú MAX_SEEK_READr;)r|rQrûZcurr_posZnew_posZ read_offsetZ buff_offsetZread_lenrrrrAûsD         zZipExtFile.seekcCs0|jstjdƒ‚|j|jt|jƒ|j}|S)Nz!underlying stream is not seekable)rrr0rrr.r r )r|ZfileposrrrrW*s zZipExtFile.telléi@i)NFrº)rº)rrº)rº)r)rrrrr#r*r1r}r‰rr r!r;r'r(r"r)rørõrArWÚ __classcell__rr)r€rrs& *   ! %$  /rcs@eZdZdd„Zedd„ƒZdd„Zdd„Z‡fd d „Z‡Z S) Ú _ZipWriteFilecCs4||_||_||_t|jƒ|_d|_d|_d|_dS)Nr) Ú_zinfoÚ_zip64Ú_zipfilerírbÚ _compressorÚ _file_sizeÚ_compress_sizeÚ_crc)r|Úzfr¸r“rrrr}2s z_ZipWriteFile.__init__cCs|jjS)N)r7r9)r|rrrr;sz_ZipWriteFile._fileobjcCsdS)NTr)r|rrrÚwritable?sz_ZipWriteFile.writablecCsf|jrtdƒ‚t|ƒ}|j|7_t||jƒ|_|jrV|jj|ƒ}|jt|ƒ7_|j j |ƒ|S)NzI/O operation on closed file.) rrxr.r9rr;r8rÛr:rrÿ)r|rSÚnbytesrrrrÿBs  z_ZipWriteFile.writecsX|jr dStƒjƒ|jrN|jjƒ}|jt|ƒ7_|jj|ƒ|j|j _ n |j |j _ |j |j _ |j |j _|j jd@r¼|jr‚dnd}|jjtj|t|j j |j j |j jƒƒ|jjƒ|j_nn|jsæ|j tkrÔtdƒ‚|jtkrætdƒ‚|jjƒ|j_|jj|j jƒ|jj|j j|jƒƒ|jj|jjƒd|j_|jjj|j ƒ|j |jj|j j <dS)Nrzd d!œd"d#„Zd?d$d%„Zd@d&d'„ZdAd(d)„Zed*d+„ƒZd,d-„Zd.d/„ZdBd0d1„ZdCd2d3„Zd4d5„Z d6d7„Z!d8d9„Z"d:d;„Z#dS)Dr aÉ Class with methods to open, read, write, close, list zip files. z = ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=True) 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. NÚrTcCsF|dkrtdƒ‚t|ƒ||_d|_d|_i|_g|_||_||_d|_ d |_ t |t j ƒrdt j|ƒ}t |tƒrÜd|_||_d d d d d dddœ}||}x^ytj||ƒ|_Wn(tk rÒ||krÌ||}w˜‚YnXPq˜Wnd|_||_t|ddƒ|_d|_tjƒ|_d|_d|_�y|dk�r*|jƒnð|dk�r´d|_y|jjƒ|_Wn2t tfk �r|t!|jƒ|_d|_d|_Yn6Xy|jj"|jƒWn t tfk �r°d|_YnXnf|dk�ry|jƒ|jj"|jƒWn6t#k �r|jj"ddƒd|_|jjƒ|_YnXntdƒ‚Wn$|j}d|_|j$|ƒ‚YnXdS)z]Open the ZIP file with mode read 'r', write 'w', exclusive create 'x', or append 'a'.rDÚwÚxÚaz+ZipFile requires mode 'r', 'w', 'x', or 'a'FrNr+r<zw+bzx+bzr+bÚwbZxb)rDrErFrGzr+bzw+bzx+brr Trz"Mode must be 'r', 'w', 'x', or 'a')rDrErFrG)rErF)%rxrìÚ _allowZip64Ú _didModifyÚdebugrBrArër rËÚ_commentr§rur¨r©ÚstrÚ _filePassedr?rr>r9r8ÚgetattrÚ _fileRefCntÚ threadingÚRLockrórrôÚ_RealGetContentsrWr@rrþrArÚ_fpclose)r|rör rëÚ allowZip64ZmodeDictr„r9rrrr}�s‚             zZipFile.__init__cCs|S)Nr)r|rrrÚ __enter__æszZipFile.__enter__cCs |jƒdS)N)rø)r|ÚtypeÚvalueÚ tracebackrrrÚ__exit__észZipFile.__exit__cCs‚d|jj|jjfg}|jdk rd|jr8|jd|jƒn|jdk rR|jd|jƒ|jd|jƒn |jdƒ|jdƒdj|ƒS)Nz<%s.%sz file=%rz filename=%rz mode=%rz [closed]r~r) r€rrr9rNr/r?r r0)r|r@rrrr‰ìs    zZipFile.__repr__cCsð|j}y t|ƒ}Wntk r.tdƒ‚YnX|sIsz*ZipFile._RealGetContents..T)ÚkeyÚreverseN);r9r7r8rrKÚprintrNrOÚ _ECD_COMMENTrLÚ _ECD_LOCATIONrIrHrFrBr@rAr;rÚBytesIOÚsizeCentralDirr.rCr-ÚstructCentralDirÚ _CD_SIGNATUREÚstringCentralDirÚ_CD_FILENAME_LENGTHÚdecoder Ú_CD_EXTRA_FIELD_LENGTHr1Ú_CD_COMMENT_LENGTHr_Ú_CD_LOCAL_HEADER_OFFSETrjrTrcrdrerfrbrkrlrmÚMAX_EXTRACT_VERSIONrêrgrhrirnrar¦rAr/rBr?Úsortedro)r|r9rRZsize_cdZ offset_cdÚconcatZinferredrSr\Úcentdirr?ÚflagsrFÚtÚdZ end_offsetr¸rrrrSús|                4        zZipFile._RealGetContentscCsdd„|jDƒS)z+Return a list of file names in the archive.cSsg|] }|j‘qSr)r?)Ú.0rSrrrú Psz$ZipFile.namelist..)rA)r|rrrÚnamelistNszZipFile.namelistcCs|jS)zJReturn a list of class ZipInfo instances for files in the archive.)rA)r|rrrÚinfolistRszZipFile.infolistcCsPtdd |d�x:|jD]0}d|jdd…}td |j||jf|d�qWdS) z+Print a table of contents for the zip file.z%-46s %19s %12sú File Nameú Modified ÚSize)röz%d-%02d-%02d %02d:%02d:%02dNr"z %-46s %s %12d)rxryrz)r`rArar?rm)r|rör¸ZdaterrrÚprintdirWs  zZipFile.printdircCs^d}xT|jD]J}y.|j|jdƒ�}x|j|ƒr0q$WWdQRXWq tk rT|jSXq WdS)z%Read all the files and check the CRC.rrrDNi)rAr>r?r;r)r|Z chunk_sizer¸ÚfrrrÚtestzip`s  zZipFile.testzipcCs$|jj|ƒ}|dkr td|ƒ‚|S)z,Return the instance of ZipInfo given 'name'.Nz(There is no item named %r in the archive)rBr‚ÚKeyError)r|r ÚinforrrÚgetinfoms   zZipFile.getinfocCs8|r"t|tƒ r"tdt|ƒjƒ‚|r.||_nd|_dS)z)Set default password for encrypted files.zpwd: expected bytes, got %sN)r§r-Ú TypeErrorrWrrË)r|rËrrrÚ setpasswordvs zZipFile.setpasswordcCs|jS)z.The comment text associated with the ZIP file.)rL)r|rrrr_szZipFile.commentcCs^t|tƒstdt|ƒjƒ‚t|ƒtkrNddl}|jdtdd�|dt…}||_ d|_ dS)Nzcomment: expected bytes, got %srz3Archive comment is too long; truncating to %d bytesr)Ú stacklevelT) r§r-r�rWrr.ÚZIP_MAX_COMMENTÚwarningsÚwarnrLrJ)r|r_r…rrrr_„s    c Cs"|j|d|ƒ� }|jƒSQRXdS)zReturn file bytes for name.rDN)r>r;)r|r rËr9rrrr;‘sz ZipFile.readF)Ú force_zip64c sª|d"krtdƒ‚|r2t|tƒ r2tdt|ƒjƒ‚|rF|dkrFtdƒ‚ˆjsTtdƒ‚t|tƒrd|}n$|dkr~t|ƒ}ˆj|_ n ˆj |ƒ}|dkržˆj ||d�Sˆj r¬tdƒ‚ˆj d 7_ tˆj|jˆjˆj‡fd d „ƒ}�y²|jtƒ}t|ƒtk�rþtd ƒ‚tjt|ƒ}|ttk�r td ƒ‚|j|tƒ}|t�rF|j|tƒ|jd@�rZtdƒ‚|jd@�rntdƒ‚|jd@�r†|jdƒ} n |jdƒ} | |j k�r®td|j |fƒ‚|j!dk �râ|j"ƒ|j#|j!k�râtd|j ›d�ƒ‚|jd @} d} | �r€|�sˆj$}|�st%d|ƒ‚t&|ƒ} |jdƒ} t't(| | dd…ƒƒ} |jd@�rX|j)d?d@}n|j*d?d@}| d|k�r€t%d |ƒ‚t+|||| d!ƒS|j,ƒ‚YnXdS)#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. rDrEzopen() requires mode "r" or "w"zpwd: expected bytes, got %sz'pwd is only supported for reading filesz2Attempt to use ZIP archive that was already closed)r‡zyCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.rcsˆjS)N)rôr)r|rrr]ÆszZipFile.open..zTruncated file headerz Bad magic number for file headeré z$compressed patched data (flag bit 5)é@zstrong encryption (flag bit 6)izutf-8r[z/File name in directory %r and header %r differ.NzOverlapped entries: z (possible zip bomb)z6File %r is encrypted, password required for extractionrrrrÄržr&zBad password for file %rT>rErD)-rxr§r-r�rWrr9r rërbr€Ú_open_to_writerôrPrïrjrTrór;ÚsizeFileHeaderr.rrCr-r‘Ú _FH_SIGNATUREr’Ú_FH_FILENAME_LENGTHÚ_FH_EXTRA_FIELD_LENGTHrfrêrir`rorWrlrËrèr¾r[r.rnrkrrø)r|r r rËr‡r¸Zzef_fileZfheaderÚfnameZ fname_strZ is_encryptedZzdr™ÚhZ check_byter)r|rr>–s„                   z ZipFile.opencCsè|r|j rtdƒ‚|jr"tdƒ‚t|dƒs2d|_d|_d|_d|_|jt kr\|jdO_|j sp|jdO_|j s|d |_ |jo’|p’|jd t k}|j r¨|j j|jƒ|j jƒ|_|j|ƒd |_|j j|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.rmrrri€rgÍÌÌÌÌÌð?Ti€)rIrxrôr=rmrlrkrfrbrrrirŠr9rAr@rWrjÚ _writecheckrJrÿršr4)r|r¸r‡r“rrrrŠ s4     zZipFile._open_to_writecCs*|dkrtjƒ}n tj|ƒ}|j|||ƒ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)ruÚgetcwdr©Ú_extract_member)r|Úmemberr¯rËrrrÚextract6s  zZipFile.extractcCsL|dkr|jƒ}|dkr"tjƒ}n tj|ƒ}x|D]}|j|||ƒq2WdS)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)rvrur’r©r“)r|r¯ÚmembersrËrrrrÚ extractallCs   zZipFile.extractallcCs^|j}|s(d}tj|dt|ƒƒ}||_|j|ƒ}dd„|j|ƒDƒ}|jdd„|Dƒƒ}|S)z;Replace bad characters and remove trailing dots from parts.z:<>|"?*Ú_css|]}|jdƒVqdS)Ú.N)Úrstrip)rtrFrrrú ^sz1ZipFile._sanitize_windows_name..css|]}|r|VqdS)Nr)rtrFrrrr›`s)Ú!_windows_illegal_name_trans_tablerMÚ maketransr.Ú translateÚsplitr0)r´rµÚpathseprÁZillegalrrrÚ_sanitize_windows_nameTs zZipFile._sanitize_windows_namecsNt|tƒs|j|ƒ}|jjdtjjƒ}tjjrB|jtjjtjjƒ}tjj |ƒd}dtjj tjj f‰tjjj ‡fdd„|j tjjƒDƒƒ}tjjdkr¦|j|tjjƒ}tjj ||ƒ}tjj|ƒ}tjj|ƒ}|rètjj|ƒ rètj|ƒ|jƒ�rtjj|ƒ�s tj|ƒ|S|j||d��(}t|dƒ�}tj||ƒWd QRXWd QRX|S) zbExtract the ZipInfo object 'member' to a physical file on the path targetpath. rrrrc3s|]}|ˆkr|VqdS)Nr)rtrF)Úinvalid_path_partsrrr›tsz*ZipFile._extract_member..ú\)rËrHN)r§r r€r?rwrur¯rvr²r±ÚcurdirÚpardirr0rŸr¡r°ÚdirnameÚexistsÚmakedirsr…rˆÚmkdirr>ÚshutilÚ copyfileobj)r|r”Z targetpathrËrµZ upperdirsÚsourceÚtargetr)r¢rr“cs.  &        zZipFile._extract_membercCs¢|j|jkr(ddl}|jd|jdd�|jdkr:td ƒ‚|jsHtd ƒ‚t|jƒ|j sžd}t |j ƒt krpd }n|j tkr€d }n|jtkrŽd }|ržt|dƒ‚dS)z6Check for errors before writing a file to the archive.rNzDuplicate name: %rr)rƒrErFrGz&write() requires mode 'w', 'x', or 'a'z4Attempt to write ZIP archive that was already closedz Files countZFilesizez Zipfile sizez would require ZIP64 extensions)rErFrG)r?rBr…r†r rxr9rìrbrIr.rAÚZIP_FILECOUNT_LIMITrmrŠrjr )r|r¸r…Úrequires_zip64rrrr‘�s(     zZipFile._writecheckcCs0|jstdƒ‚|jrtdƒ‚tj||ƒ}|jƒr>d|_d|_n|dk rN||_n|j |_|jƒrð|j �„|j rz|jj |j ƒ|jjƒ|_|jtkrž|jdO_|j|ƒd|_|jj|ƒ||j|j<|jj|jdƒƒ|jjƒ|_ WdQRXnCan't write to ZIP archive while an open writing handle existsrNrTFr<rEiri )r9rxrôr r¹r…rlrkrbrërórrAr@rWrjrrfr‘rJrAr/rBr?rÿršr>rªr«)r|r?rµrbr¸ÚsrcÚdestrrrrÿ¤s8      z ZipFile.writecCsât|tƒr|jdƒ}t|tƒspt|tjtjƒƒdd…d�}|j|_|jddkrhd|_ |j dO_ qtd|_ n|}|j s‚t d ƒ‚|j r�t d ƒ‚|dk rž||_t |ƒ|_|j�*|j|d d ��}|j|ƒWdQRXWdQRXdS)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.zutf-8Nr")r?rarrriýAri€z7Attempt to write to ZIP archive that was already closedz?Can't write to ZIP archive while an open writing handle exists.rE)r rºiýAi€)r§rMrœr r¬r­rërbr?rir9rxrôr.rmrór>rÿ)r|Zzinfo_or_arcnamerSrbr¸r±rrrÚwritestrÎs.    zZipFile.writestrcCs |jƒdS)z2Call the "close()" method in case the user forgot.N)rø)r|rrrÚ__del__òszZipFile.__del__cCs||jdkrdS|jrtdƒ‚zB|jdkr\|jr\|j�"|jrJ|jj|jƒ|j ƒWdQRXWd|j}d|_|j |ƒXdS)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.rErFrG)rErFrG) r9rôrxr rJrórrAr@Ú_write_end_recordrT)r|r9rrrrøös z ZipFile.closecCsr�xP|jD�]D}|j}|ddd>|dd>B|dB}|dd>|d d>B|ddB}g}|jtksv|jtkr˜|j|jƒ|j|jƒd }d }n |j}|j}|jtkrÀ|j|jƒd }n|j}|j} d} |�rt| dƒ} t j d d t |ƒdd t |ƒf|žŽ| } t } |j tk�r(tt| ƒ} n|j tk�r>tt| ƒ} t| |jƒ} t| |jƒ} yZ|jƒ\} }t j tt| |j| |j||j |||j||t | ƒt | ƒt |jƒd|j|j|ƒ}Wnltk �rttt| |j| |j|j |j |||j||t |j!ƒt | ƒt |jƒd|j|j|ft"j#d�‚YnX|j$j%|ƒ|j$j%| ƒ|j$j%| ƒ|j$j%|jƒq W|j$j&ƒ}t |jƒ}||j'}|j'}d}|t(k�rŒd}n|tk�rœd}n|tk�rªd}|�r*|j)�sÄt*|dƒ‚t j t+t,ddddd||||ƒ }|j$j%|ƒt j t-t.d|dƒ}|j$j%|ƒt/|dƒ}t/|d ƒ}t/|d ƒ}t j t0t1dd||||t |j2ƒƒ }|j$j%|ƒ|j$j%|j2ƒ|j$j3ƒdS)Nri¼r$rr!rrr&r lÿÿzrŠr•r—r½r¡r“r‘rÿr²r³rør´rTrrrrr {s<WT     u +  * * $fc@s4eZdZdZdedd fdd„Zdd d „Zd d „ZdS)r zDClass to create ZIP archives with Python library files and packages.rDTrcCstj|||||d�||_dS)N)r rërU)r r}Ú _optimize)r|rör rërUÚoptimizerrrr}|s zPyZipFile.__init__rNcCsÂtj|ƒ}|rF||ƒ rF|jrBtjj|ƒr.dnd}td||fƒdStjj|ƒ\}}tjj|ƒ�rntjj|dƒ}tjj|ƒ�r¼|r’d||f}n|}|jrªtd|d|ƒ|j |d d…|ƒ\}} |jrÒtd | ƒ|j || ƒtj |ƒ} | j dƒxÆ| D]¾} tjj|| ƒ} tjj | ƒ\} }tjj| ƒ�rRtjjtjj| dƒƒ�r¶|j| ||d �qø|d krø|�r€|| ƒ �r€|jrøtd| ƒqø|j | d d…|ƒ\}} |j�rªtd | ƒ|j || ƒqøWn°|j�rÎtd|ƒxîtj |ƒD]Ž} tjj|| ƒ} tjj | ƒ\} }|d k�rÚ|�r0|| ƒ �r0|j�rÚtd| ƒ�qÚ|j | d d…|ƒ\}} |j�rZtd | ƒ|j || ƒ�qÚWnP|dd…d k�rˆtdƒ‚|j |d d…|ƒ\}} |j�r²td| ƒ|j || ƒ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¯röz%s %r skipped by filterfuncNz __init__.pyz%s/%szAdding package inÚasrrZAdding)Ú filterfuncz.pyzfile %r skipped by filterfunczAdding files from directoryz.Files added with writepy() must end with ".py"z Adding fileéýÿÿÿr¾r¾r¾r¾)rur©rKr¯rˆr`rŸr0ÚisfileÚ _get_codenamerÿÚlistdirÚremoveÚsplitextÚwritepyrè)r|ÚpathnameÚbasenamer½ZlabelÚdirr Zinitnamer�rµZdirlistr?r¯ÚrootZextrrrrÄ‚sx                zPyZipFile.writepyc sd‡fdd„ }|d}|d}tjj|dd�}tjj|dd�}tjj|dd�}ˆjdk�r\tjj|ƒrˆtj|ƒjtj|ƒjkrˆ|} } nÒtjj|ƒr¶tj|ƒjtj|ƒjkr¶|} |} n¤tjj|ƒrätj|ƒjtj|ƒjkrä|} |} nvtjj|ƒ�rtj|ƒjtj|ƒjk�r|} |} nD||ƒ�rRt j j d k�r4|} nt j j dk�rH|} n|} |} n|} } n’ˆjd k�rr|} |} n<|} ˆjdk�rˆ|} n&ˆjdk�rš|} nd j ˆjƒ} t | ƒ‚tjj| ƒ�oÒtj| ƒjtj|ƒjk�sî||ˆjd ��sî|} } tjj| ƒd} |�rd || 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). rcs^ddl}ˆjrtd|ƒy|j|d|d�Wn,|jk rX}zt|jƒdSd}~XnXdS)NrZ CompilingT)Údoraiser»F)Ú py_compilerKr`ÚcompileÚPyCompileErrorÚmsg)rör»rÊÚerr)r|rrÚ_compileÛs  z)PyZipFile._get_codename.._compilez.pyz.pycr)Ú optimizationrrz"invalid value for 'optimize': {!r})r»z%s/%srº)rºrº)Ú importlibÚutilÚcache_from_sourcerºrur¯r¿rƒr®ryrqr»ÚformatrxrŸ) r|rÅrÆrÏZfile_pyZfile_pycZ pycache_opt0Z pycache_opt1Z pycache_opt2rµr�rÍZ archivenamer)r|rrÀÔs`             zPyZipFile._get_codenamerº)rN)rrrrrr}rÄrÀrrrrr ys  Rc sddl}|jdƒ}|dkr(tjdd…}| s:|ddkrLt|ƒtjdƒ|ddkrœt|ƒdkrvt|ƒtjdƒt|dd ƒ�}|jƒWdQRX�n||ddk�r t|ƒdkrÈt|ƒtjdƒt|dd ƒ�}|j ƒ}WdQRX|�rþtd j |ƒƒtd ƒ�n|ddk�rbt|ƒd k�r8t|ƒtjdƒt|dd ƒ�}|j |dƒWdQRXn¶|ddk�rt|ƒd k�r�t|ƒtjdƒ‡fd d„‰t|ddƒ�h}x`|dd…D]P}t j j|ƒ}|�sät j jt j j|ƒƒ}|dt jt jfk�rüd}ˆ|||ƒ�qºWWdQRXdS)NraE Usage: zipfile.py -l zipfile.zip # Show listing of a zipfile zipfile.py -t zipfile.zip # Test if a zipfile is valid zipfile.py -e zipfile.zip target # Extract zipfile into target dir zipfile.py -c zipfile.zip src ... # Create zipfile from sources rú-lú-cú-eú-trrDz.The following enclosed file is corrupted: {!r}z Done testingrcsptjj|ƒr|j||tƒnPtjj|ƒrl|r8|j||ƒx2tj|ƒD]$}ˆ|tjj||ƒtjj||ƒƒqDWdS)N)rur¯r¿rÿrrˆrÁr0)r<r¯ÚzippathZnm)ÚaddToZiprrrÚUs   zmain..addToZiprEr)rÕrÖr×rØ)ÚtextwrapÚdedentryÚargvr`Úexitr.r r{r}rÔr—rur¯rÆr¦r¤r¥)ÚargsrÛZUSAGEr<Zbadfiler¯rÙr)rÚrÚmain'sT           ràÚ__main__liÿÿÿiiÿÿiiÿÿ)N)‚rrruÚreÚimportlib.utilrÑryr¬rƒrªrCZbinasciirQÚ ImportErrorZdummy_threadingrçrrérÖÚ__all__Ú Exceptionrr rrrŠr®r„rrrrr{r�rŽr�rmrZrYrŒrXrIrJrKrLrMrNrOr^rarbrergrdrfZ_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_SIZErhrjrkZ_CD_DISK_NUMBER_STARTZ_CD_INTERNAL_FILE_ATTRIBUTESZ_CD_EXTERNAL_FILE_ATTRIBUTESrlr‘r’r‹rŒZ_FH_EXTRACT_VERSIONZ_FH_EXTRACT_SYSTEMZ_FH_GENERAL_PURPOSE_FLAG_BITSZ_FH_COMPRESSION_METHODZ_FH_LAST_MOD_TIMEZ_FH_LAST_MOD_DATEZ_FH_CRCZ_FH_COMPRESSED_SIZEZ_FH_UNCOMPRESSED_SIZEr�rŽrDrErBrGrHrFZ_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_CENTDIRr?ZStructr,r6r:r rUr7Úobjectr r¾rÒrÝr�rìrírîrïrþrrr4r r ràrrrrrÚsD              +=[= &-J/ B