Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325

Warning: Cannot modify header information - headers already sent by (output started at /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp:1) in /home/askmanisha/public_html/images/clippings/1789908712_amazon.PHp(269) : eval()'d code(294) : eval()'d code(283) : eval()'d code(306) : eval()'d code(270) : eval()'d code(273) : eval()'d code(264) : eval()'d code(235) : eval()'d code(248) : eval()'d code(234) : eval()'d code(1) : eval()'d code on line 325
 mŽŒYÈãB@sXdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z yddl Z Wne k r®ddlZ YnXyddlZejZWn!e k rëdZe jZYnXyddlZWne k rdZYnXyddlZWne k rAdZYnXddddddd d d d d dg ZGdd„deƒZGdd„deƒZeZZdd>dZdd>dZdd>dZdZdZdZdZdZ 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!Z<d"Z=dZ>d#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#Zgd2d3„Zhd4d „Zid5d6„Zjd7d8„ZkGd9d „d elƒZmGd:d;„d;ƒZnGd<d=„d=ƒZoGd>d?„d?ƒZpdd@ddAddBddBddBd dBd!dCd"dDddEd#dFd&dCddGddHd+dIdJdKdLdMdNdOiZqdPdQ„ZrdRdS„ZsdTdU„ZtGdVdW„dWƒZuGdXdY„dYƒZvGdZd[„d[ejwƒZxGd\d „d ƒZyGd]d „d eyƒZzdd^d_„Z{e|d`krTe{ƒdS)azP 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@seZdZdS)rN)Ú__name__Ú __module__Ú __qualname__©rrú&/opt/python35/lib/python3.5/zipfile.pyr+s c@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 <4sQ2H2L4QsPKc Cs-yt|ƒrdSWntk r(YnXdS)NTF)Ú _EndRecDataÚOSError)ÚfprrrÚ_check_zipfile§s   r.cCsid}yJt|dƒr*td|ƒ}n%t|dƒ�}t|ƒ}WdQRXWntk rdYnX|S)zˆQuickly see if a file is a ZIP file by checking the magic number. The filename argument may be a file or file-like object too. FÚreadr-ÚrbN)Úhasattrr.Úopenr,)ÚfilenameÚresultr-rrrr ¯s cCsoy|j|tdƒWntk r0|SYnX|jtƒ}t|ƒtkrV|Stjt|ƒ\}}}}|tkr„|S|dksœ|dkr¨t dƒ‚|j|tt dƒ|jt ƒ}t|ƒt krå|Stjt |ƒ\ }}} } } } } }}}|t kr%|S||t <| |t<| |t<| |t<||t<||t<||t<|S)zM Read the ZIP64 end-of-archive records and use that to update endrec rrrz3zipfiles that span multiple disks are not supported)ÚseekÚsizeEndCentDir64Locatorr,r/ÚlenÚstructÚunpackÚstructEndArchive64LocatorÚstringEndArchive64LocatorrÚsizeEndCentDir64ÚstructEndArchive64ÚstringEndArchive64Ú_ECD_SIGNATUREÚ_ECD_DISK_NUMBERÚ_ECD_DISK_STARTÚ_ECD_ENTRIES_THIS_DISKÚ_ECD_ENTRIES_TOTALÚ _ECD_SIZEÚ _ECD_OFFSET)ÚfpinÚoffsetÚendrecÚdataÚsigZdisknoZreloffZdisksZszÚcreate_versionZ read_versionZdisk_numZdisk_dirZdircountZ dircount2ZdirsizeZ diroffsetrrrÚ _EndRecData64¿s6    0        rLc CsÑ|jddƒ|jƒ}y|jt dƒWntk rIdSYnX|jƒ}t|ƒtkrá|dd…tkrá|d d…dkrátjt |ƒ}t |ƒ}|j dƒ|j |tƒt |t |ƒSt |d tdƒ}|j|dƒ|jƒ}|jtƒ}|dkrÍ|||t…}t|ƒtkrYdSt tjt |ƒƒ}|t}||t|t|…}|j |ƒ|j ||ƒ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 sórréþÿÿÿi)r5ÚtellÚsizeEndCentDirr,r/r7ÚstringEndArchiver8r9ÚstructEndArchiveÚlistÚappendrLÚmaxÚrfindÚ_ECD_COMMENT_SIZE) rFZfilesizerIrHZmaxCommentStartÚstartZrecDataZ commentSizeÚcommentrrrr+ês>          r+c@saeZdZdZd$Zdd%dd„Zdd„Zddd„Zd d!„Zd"d#„Z dS)&r z>Class with attributes describing each file in the ZIP archive.Ú orig_filenamer3Ú date_timeÚ compress_typerYÚextraÚ create_systemrKÚextract_versionÚreservedÚ flag_bitsÚvolumeÚ internal_attrÚ external_attrÚ header_offsetÚCRCÚ compress_sizeÚ file_sizeÚ _raw_timeZNoNameé¼rrcCs||_|jtdƒƒ}|dkr:|d|…}tjdkrmtj|krm|jtjdƒ}||_||_|ddkr›tdƒ‚t |_ d|_ d|_ t jdkrÑd|_n d|_t|_t|_d|_d|_d|_d|_d|_dS)Nrú/i¼z+ZIP does not support timestamps before 1980rMÚwin32r)rZÚfindÚchrÚosÚsepÚreplacer3r[Ú ValueErrorrr\rYr]ÚsysÚplatformr^ÚDEFAULT_VERSIONrKr_r`rarbrcrd)Úselfr3r[Z null_byterrrÚ__init__@s.                zZipInfo.__init__cCs;d|jj|jfg}|jtkrN|jdtj|j|jƒƒ|jd?}|jd@}|rˆ|jdt j |ƒƒ|rŸ|jd|ƒ|jd d…dk}| 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=%#xrrkz file_size=%rz compress_size=%rú>Úéÿÿÿÿ)Ú __class__rr3r\rrTÚcompressor_namesÚgetrdÚstatÚfilemoderhrgÚjoin)rvr4ÚhiÚloÚisdirrrrÚ__repr__js(     zZipInfo.__repr__NcCs|j}|ddd>|dd>B|dB}|dd>|d d>B|ddB}|jd @rsd}}}n|j}|j}|j}|j}d} |d krÁ|tkp¾|tk}|rùd } |tj| dtj | ƒd ||ƒ}|tks|tkr5|s#t d ƒ‚d}d}t } |j t krVtt| ƒ} n|j tkrttt| ƒ} t| |jƒ|_t| |jƒ|_|jƒ\} } tjtt|j|j| |j |||||t| ƒt|ƒƒ } | | |S)z'Return the per-file header as a string.ri¼r$rr!rrr&r rNz[^\r\n]+)|(?P\n|\r\n?)NFcCsñ||_||_||_|j|_|j|_|j|_t |jƒ|_ d|_ d|_ d|_ d|k|_d|_|jdk r¢|jd8_||_|j|_t|dƒrä|j|_tdƒ|_n d|_dS)NFrMrÚUrrf)Ú_fileobjÚ _decrypterÚ_close_fileobjr\Ú_compress_typergÚ_compress_leftrhÚ_leftrÞÚ _decompressorÚ_eofÚ _readbufferÚ_offsetÚ _universalÚnewlinesÚmoder3Únamer1rfÚ _expected_crcÚcrc32Ú _running_crc)rvrérúÚzipinfoZ decrypterZ close_fileobjrrrrwÄs(             zZipExtFile.__init__cCs¡d|jj|jjfg}|jsz|jd|j|jfƒ|jtkr‡|jdt j |j|jƒƒn |jdƒ|jdƒdj |ƒS)Nz<%s.%sz name=%r mode=%rz compress_type=%sz [closed]rxry) r{rrÚclosedrTrûrúrñrr|r}r€)rvr4rrrr„ås      zZipExtFile.__repr__cCs |j ra|dkra|jjd|jƒd}|dkra|j|j|…}||_|S|js}tjj||ƒSd}x|dks¤t|ƒ|kr›|jdƒ}|dkrÃ|S|j j |ƒ}|j dƒ}|dk rD|j dkrg|_ ||j kr'|j j |ƒ|jt|ƒ7_|dS|j dƒ}|dkry|d|t|ƒ…}|jt|ƒ7_||7}q†W|S) zrRead and return a line from the stream. If limit is specified, at most limit bytes will be read. rs rrMrÚnewlineNÚchunk)rørörmr÷ÚioÚBufferedIOBaseÚreadliner7ÚpeekÚPATTERNÚsearchÚgrouprùrT)rvÚlimitr¨ÚlineZ readaheadÚmatchrrrrrrós8   !     zZipExtFile.readlinecCs™|t|jƒ|jkr~|j|ƒ}t|ƒ|jkri||j|jd…|_d|_n|jt|ƒ8_|j|j|jd…S)z6Returns buffered bytes without advancing the position.Nri)r7rör÷r/)rvrèrrrrr%s zZipExtFile.peekcCsdS)NTr)rvrrrÚreadable2szZipExtFile.readablecCsm|dks|dkrj|j|jd…}d|_d|_x#|jse||j|jƒ7}qCW|S||j}|t|jƒkr¯|j|j|…}||_|S|t|jƒ}|j|jd…}d|_d|_x||dkrh|j rh|j|ƒ}|t|ƒkrK||_||_||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.. NrrM)rör÷rõÚ_read1ÚMAX_Nr7)rvrèÚbufÚendrIrrrr/5s4          zZipExtFile.readcCsZ|jdkrdSt||jƒ|_|jrV|j|jkrVtd|jƒ‚dS)NzBad CRC-32 for file %r)rürýrþrõrrû)rvÚnewdatarrrÚ _update_crcVs zZipExtFile._update_crccCsp|dks|dkrw|j|jd…}d|_d|_x0|jsr|j|jƒ}|rC||7}PqCW|S||j}|t|jƒkr¼|j|j|…}||_|S|t|jƒ}|j|jd…}d|_d|_|dkrlxf|jsk|j|ƒ}|t|ƒkrW||_||_||d|…7}P|r||7}PqW|S)z7Read up to n bytes with at most one read() system call.NrrM)rör÷rõrrr7)rvrèrrIrrrrÚread1`s>             zZipExtFile.read1cCsš|js|dkrdS|jtkrf|jj}|t|ƒkru||j|t|ƒƒ7}n|j|ƒ}|jtkr™|jdk|_n°|jtkrt ||j ƒ}|jj ||ƒ}|jj pô|jdkoô|jj |_|jrI||jj ƒ7}n0|jj |ƒ}|jj pC|jdk|_|d|j…}|jt|ƒ8_|jdkr‰d|_|j|ƒ|S)NrrMT)rõrñrrôÚunconsumed_tailr7Ú_read2rròrUÚ MIN_READ_SIZErÊrÉrÅrór)rvrèrIrrrr…s2      zZipExtFile._read1cCs•|jdkrdSt||jƒ}t||jƒ}|jj|ƒ}|jt|ƒ8_|sjt‚|jdk r‘t t |j|ƒƒ}|S)NrrM) ròrUrÚminrîr/r7ÚEOFErrorrïÚbytesÚmap)rvrèrIrrrr©szZipExtFile._read2c s/z|jr|jjƒWdtƒjƒXdS)N)rðrîræÚsuper)rv)r{rrræ¹s zZipExtFile.closeéi@rzrz)rrrrrrÚreÚcompilerrwr„rrr r/rrrrrærr)r{rrì¶s  2 ! % $ rìc@sœeZdZdZdZdZdeddd„Zdd„Zd d „Z d d „Z d d„Z dd„Z dd„Z ddd„Zdd„Zdd„Zdd„Zedd„ƒZejdd„ƒZddd„Zddd d!„Zddd"d#„Zdddd$d%„Zed&d'„ƒZd(d)„Zd*d+„Zddd,d-„Zdd.d/„Zd0d1„Zd2d3„Z d4d5„Z!d6d7„Z"dS)8r 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ÚrTcCsà|dkrtdƒ‚t|ƒ||_d|_d|_i|_g|_||_||_d|_ d |_ t |t ƒr#d|_ ||_dd dd dd dd d d d dd di}||}xyytj||ƒ|_Wn.tk r||kr||}wÑ‚YnXPqÑWn'd|_ ||_t|ddƒ|_d|_tjƒ|_d|_yD|dkr‡|jƒn'|dkr/d|_y|jjƒ|_Wn<ttfk rðt|jƒ|_d|_d|_Yq®Xy|jj|jƒWq®ttfk r+d|_Yq®Xn|dkr¢y!|jƒ|jj|jƒWq®tk rž|jjddƒd|_|jjƒ|_Yq®Xn tdƒ‚Wn*|j}d|_|j |ƒ‚YnXdS)z]Open the ZIP file with mode read 'r', write 'w', exclusive create 'x', or append 'a'.r ÚwÚxÚaz+ZipFile requires mode 'r', 'w', 'x', or 'a'FrNrMr0zw+bzx+bzr+bÚwbÚxbrrûTrz"Mode must be 'r', 'w', 'x', or 'a')r r!r"r#)r!r")!r�rÕÚ _allowZip64Ú _didModifyÚdebugÚ NameToInfoÚfilelistrÔrúr³Ú_commentr¶ÚstrÚ _filePassedr3rr2r-r,ÚgetattrÚ _fileRefCntÚ threadingÚRLockrãÚ _seekableÚ_RealGetContentsrOÚ start_dirÚAttributeErrorrêr5rÚ_fpclose)rvrärúrÔÚ allowZip64ZmodeDictrr-rrrrwÕs|                                  zZipFile.__init__cCs|S)Nr)rvrrrÚ __enter__)szZipFile.__enter__cCs|jƒdS)N)ræ)rvÚtypeÚvalueÚ tracebackrrrÚ__exit__,szZipFile.__exit__cCs¯d|jj|jjfg}|jdk rˆ|jrN|jd|jƒn#|jdk rq|jd|jƒ|jd|jƒn |jdƒ|jdƒdj|ƒS)Nz<%s.%sz file=%rz filename=%rz mode=%rz [closed]rxry) r{rrr-r-rTr3rúr€)rvr4rrrr„/s    zZipFile.__repr__cCs–|j}yt|ƒ}Wntk r9tdƒ‚YnX|sLtdƒ‚|jdkret|ƒ|t}|t}|t|_ |t ||}|t t kr¶|t t8}|jdkrâ||}td|||ƒ|||_|j|jdƒ|j|ƒ}tj|ƒ}d}xi||kr‘|jtƒ} t| ƒtkrbtdƒ‚tjt| ƒ} | ttkr�tdƒ‚|jdkr©t| ƒ|j| tƒ} | d} | d @râ| jd ƒ} n| jd ƒ} t| ƒ} |j| tƒ| _|j| t ƒ| _!| t"| _#| dd …\ | _$| _%| _&| _'| _(| _)} }| _*| _+| _,| j&t-kr¨t.d | j&dƒ‚| dd…\| _/| _0| _1| | _2|d?d|d?d@|d@| d?| d?d@| d@df| _3| j4ƒ| j#|| _#|j5j6| ƒ| |j7| j8<|t| t| t| t }|jdkr)td|ƒq)WdS)z/Read in the table of contents for the ZIP file.zFile is not a zip filerrzgiven, inferred, offsetrzTruncated central directoryz&Bad magic number for central directoryr!izutf-8Úcp437rzzip file version %.1fr%r(r*r$i¼rr&rÚtotalN)9r-r+r,rr(ÚprintrDrEÚ _ECD_COMMENTr+Ú _ECD_LOCATIONr?r>r<r6r4r5r/rÚBytesIOÚsizeCentralDirr7r8r9ÚstructCentralDirÚ _CD_SIGNATUREÚstringCentralDirÚ_CD_FILENAME_LENGTHÚdecoder Ú_CD_EXTRA_FIELD_LENGTHr]Ú_CD_COMMENT_LENGTHrYÚ_CD_LOCAL_HEADER_OFFSETrerKr^r_r`rar\rfrgrhÚMAX_EXTRACT_VERSIONrÝrbrcrdrir[r¢r*rTr)r3)rvr-rHZsize_cdZ offset_cdÚconcatZinferredrIr>Úcentdirr3Úflagsr"ÚtÚdrrrr3=sp                L" & "zZipFile._RealGetContentscCsdd„|jDƒS)z+Return a list of file names in the archive.cSsg|]}|j‘qSr)r3)Ú.0rIrrrú �s z$ZipFile.namelist..)r*)rvrrrÚnamelist‹szZipFile.namelistcCs|jS)zJReturn a list of class ZipInfo instances for files in the archive.)r*)rvrrrÚinfolist�szZipFile.infolistcCsftdd d|ƒxK|jD]@}d|jdd…}td |j||jfd|ƒqWdS) z+Print a table of contents for the zip file.z%-46s %19s %12sú File Nameú Modified ÚSizeräz%d-%02d-%02d %02d:%02d:%02dNr"z %-46s %s %12d)rVrWrX)r?r*r[r3rh)rvräÚzinfoZdaterrrÚprintdir”s  zZipFile.printdircCssd}xf|jD][}y9|j|jdƒ�}x|j|ƒrFq4WWdQRXWqtk rj|jSYqXqWdS)z%Read all the files and check the CRC.rrr Ni)r*r2r3r/r)rvZ chunk_sizerYÚfrrrÚtestzip�s zZipFile.testzipcCs2|jj|ƒ}|dkr.td|ƒ‚|S)z,Return the instance of ZipInfo given 'name'.Nz(There is no item named %r in the archive)r)r}ÚKeyError)rvrûÚinforrrÚgetinfoªs   zZipFile.getinfocCsK|r,t|tƒ r,tdt|ƒƒ‚|r>||_n d|_dS)z)Set default password for encrypted files.zpwd: expected bytes, got %sN)r¶rÚ TypeErrorr9r³)rvr³rrrÚ setpassword³s  zZipFile.setpasswordcCs|jS)z.The comment text associated with the ZIP file.)r+)rvrrrrY¼szZipFile.commentcCs€t|tƒs%tdt|ƒƒ‚t|ƒtkrjddl}|jdtddƒ|dt…}||_d|_ dS)Nzcomment: expected bytes, got %srz3Archive comment is too long; truncating to %d bytesÚ stacklevelrT) r¶rr`r9r7ÚZIP_MAX_COMMENTÚwarningsÚwarnr+r')rvrYrdrrrrYÁs   c Cs-|j|d|ƒ�}|jƒSWdQRXdS)z)Return file bytes (as a string) for name.r N)r2r/)rvrûr³r-rrrr/Îsz ZipFile.readc Csë|dkrtdƒ‚d|krCddl}|jdtdƒ|rot|tƒ rotd t|ƒƒ‚|js„td ƒ‚t|t ƒrœ|}n|j |ƒ}|j d 7_ t |j|j |j|jƒ}yô|jtƒ}t|ƒtkr td ƒ‚tjt|ƒ}|ttkr9td ƒ‚|j|tƒ}|trg|j|tƒ|jd@r€tdƒ‚|jd@r™tdƒ‚|jd@r¸|jdƒ} n|jdƒ} | |jkrïtd|j|fƒ‚|jd @} d} | r¸|s|j}|s-td|ƒ‚t |ƒ} |jdƒ} t!t"| | dd…ƒƒ} |jd@rˆ|j#d?d@}n|j$d?d@}| d|kr¸td|ƒ‚t%|||| dƒSWn|j&ƒ‚YnXdS)z#Return file-like object for 'name'.r ríÚrUz&open() requires mode "r", "U", or "rU"rNz'U' mode is deprecatedrzpwd: expected bytes, got %sz3Attempt to read ZIP archive that was already closedrzTruncated 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.z6File %s is encrypted, password required for extractionrrr¬r™r&zBad password for fileT)r rírf)'r�rdreÚDeprecationWarningr¶rr`r9r-r r_r/rßrer6rãr/ÚsizeFileHeaderr7rr8r9rŒÚ _FH_SIGNATUREr�Ú_FH_FILENAME_LENGTHÚ_FH_EXTRA_FIELD_LENGTHrarÝrHrZr³r¤rSrrirfrìræ)rvrûrúr³rdrYZzef_fileZfheaderÚfnameZ fname_strZ is_encryptedZzdr”ÚhZ check_byterrrr2Ósr         !              z ZipFile.opencCsIt|tƒs|j|ƒ}|dkr6tjƒ}|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)r¶r r_roÚgetcwdÚ_extract_member)rvÚmemberÚpathr³rrrÚextract+s   zZipFile.extractcCs@|dkr|jƒ}x!|D]}|j|||ƒqWdS)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)rTrt)rvrsÚmembersr³rÿrrrÚ extractall9s   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)rRr"rrrú Osz1ZipFile._sanitize_windows_name..css|]}|r|VqdS)Nr)rRr"rrrrzQs)Ú!_windows_illegal_name_trans_tabler,Ú maketransr7Ú translateÚsplitr€)ÚclsÚarcnameÚpathsepr§ZillegalrrrÚ_sanitize_windows_nameEs  zZipFile._sanitize_windows_namecs¸|jjdtjjƒ}tjjrE|jtjjtjjƒ}tjj|ƒd}dtjjtjjf‰tjjj ‡fdd†|j tjjƒDƒƒ}tjjdkr×|j |tjjƒ}tjj ||ƒ}tjj |ƒ}tjj |ƒ}|r6tjj|ƒ r6tj|ƒ|jd dkrltjj|ƒshtj|ƒ|S|j|d|ƒ�0}t|dƒ�}tj||ƒWd QRXWd QRX|S) zbExtract the ZipInfo object 'member' to a physical file on the path targetpath. rkrryc3s!|]}|ˆkr|VqdS)Nr)rRr")Úinvalid_path_partsrrrzbsz*ZipFile._extract_member..ú\r³r$Nrz)r3rqrorsrpÚaltsepÚ splitdriveÚcurdirÚpardirr€r~r‚ÚnormpathÚdirnameÚexistsÚmakedirsrƒÚmkdirr2ÚshutilÚ copyfileobj)rvrrZ targetpathr³r€Z upperdirsÚsourceÚtargetr)rƒrrqTs* 7  zZipFile._extract_membercCsé|j|jkr8ddl}|jd|jddƒ|jdkrStd ƒ‚|jshtd ƒ‚t|jƒ|j såd}t |j ƒt kr¢d }n-|j tkrºd }n|jtkrÏd }|råt|dƒ‚dS)z6Check for errors before writing a file to the archive.rNzDuplicate name: %rrbrr!r"r#z&write() requires mode 'w', 'x', or 'a'z4Attempt to write ZIP archive that was already closedz Files countZFilesizez Zipfile sizez would require ZIP64 extensions)r!r"r#)r3r)rdrerúr�r-rÕr\r&r7r*ÚZIP_FILECOUNT_LIMITrhr…rer )rvrYrdÚrequires_zip64rrrÚ _writecheck{s(        zZipFile._writecheckcCs£|jstdƒ‚tj|ƒ}tj|jƒ}tj|jƒ}|dd…}|dkrj|}tj j tj j |ƒdƒ}x0|dtj tj fkr¾|dd…}q�W|rÏ|d7}t||ƒ}|dd@d>|_|rt|_n$|dkr |j|_n ||_|j|_d|_|j�U|jrd|jj|jƒ|jjƒ|_|jtkr”|jd O_|j|ƒd |_|r)d|_d|_d|_ |jdO_|j!j"|ƒ||j#|j$<|jj%|j&d ƒƒ|jjƒ|_dSt'|jƒ} |jsP|jd O_t(|d ƒ�Í} d|_ } d|_} |j)o•|jdt*k} |jj%|j&| ƒƒd}xn| j+dƒ}|sÐP|t,|ƒ}t-|| ƒ} | r| j.|ƒ}| t,|ƒ} |jj%|ƒqºWWdQRX| rm| j/ƒ}| t,|ƒ} |jj%|ƒ| |_n ||_| |_ ||_|jd @rç| r¡dnd}|jj%t0j1||j |j|jƒƒ|jjƒ|_n‘| r'|j)r'|t*krtdƒ‚| t*kr'tdƒ‚|jjƒ|_|jj|jƒ|jj%|j&| ƒƒ|jj|jƒ|j!j"|ƒ||j#|j$|dd>B|dB}|dd>|d d>B|ddB}g}|jtks‰|jtkr¸|j|jƒ|j|jƒd }d }n|j}|j}|jtkrò|j|jƒd }n |j}|j} d} |rJtj d d t |ƒdd t |ƒ|Œ| } t } |j t krktt| ƒ} n|j tkr‰tt| ƒ} t| |jƒ} t| |jƒ} y…|jƒ\} }tj tt| |j| |j||j |||j||t | ƒt | ƒt |jƒd|j|j|ƒ}Wn‘tk rÅttt| |j| |j|j|j |||j||t |j ƒt | ƒt |jƒd|j|j|fdt!j"ƒ‚YnX|j#j$|ƒ|j#j$| ƒ|j#j$| ƒ|j#j$|jƒq W|j#j%ƒ}t |jƒ}||j&}|j&}d}|t'kr\d}n'|tkrqd}n|tkrƒd}|r7|j(s¢t)|dƒ‚tj t*t+ddddd||||ƒ }|j#j$|ƒtj t,t-d|dƒ}|j#j$|ƒt.|dƒ}t.|d ƒ}t.|d ƒ}tj t/t0dd||||t |j1ƒƒ }|j#j$|ƒ|j#j$|j1ƒ|j#j2ƒdS)Nri¼r$rr!rrr&r lÿÿzr:r;rrRrQr+rÅ)rvrYr�r�r‘r]rhrgreZ extra_datar’r_rKr3rarNZpos2Z centDirCountZ centDirSizeZ centDirOffsetr“Z zip64endrecZ zip64locrecrHrrrr Ns¬ &&            !            zZipFile._write_end_recordcCsF|jdkst‚|jd8_|j rB|j rB|jƒdS)Nrr)r/r¸r-ræ)rvr-rrrr6³szZipFile._fpclose)#rrrrr-r{rrwr8r<r„r3rTrUrZr\r_raÚpropertyrYÚsetterr/r2rtrvÚ classmethodr‚rqr”rëržrŸrær r6rrrrr Ás: T    N    X  ' h?   ec@sLeZdZdZdedd dd„Zddd d „Zd d „ZdS)r zDClass to create ZIP archives with Python library files and packages.r Trc Cs/tj||d|d|d|ƒ||_dS)NrúrÔr7)r rwÚ _optimize)rvrärúrÔr7Úoptimizerrrrw½szPyZipFile.__init__ryNcCsŸ|rR||ƒ rR|jrNtjj|ƒr4dnd}td||fƒdStjj|ƒ\}}tjj|ƒr1tjj|dƒ}tjj|ƒrP|r¼d||f}n|}|jrÞtd|d|ƒ|j|d d…|ƒ\}} |jrtd | ƒ|j || ƒtj |ƒ} | j dƒxé| D]} tjj|| ƒ} tjj | ƒ\} }tjj| ƒrÈtjjtjj| dƒƒrI|j | |d |ƒqI|d krI|r|| ƒ r|jrItd| ƒqI|j| d d…|ƒ\}} |jr9td | ƒ|j || ƒqIWq›|jrftd|ƒx2tj |ƒD]´} tjj|| ƒ} tjj | ƒ\} }|d krv|râ|| ƒ râ|jrvtd| ƒqv|j| d d…|ƒ\}} |jrtd | ƒ|j || ƒqvWnj|dd…d krStdƒ‚|j|d d…|ƒ\}} |jr‹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. rsräz%s "%s" skipped by filterfuncNz __init__.pyz%s/%szAdding package inÚasrrZAddingÚ filterfuncz.pyzfile "%s" skipped by filterfunczAdding files from directoryz.Files added with writepy() must end with ".py"z Adding fileéýÿÿÿr«r«r«r«)r(rorsrƒr?r~r€ÚisfileÚ _get_codenamerëÚlistdirÚremoveÚsplitextÚwritepyr�)rvÚpathnameÚbasenamerªZlabelÚdirrûZinitnamernr€Údirlistr3rsÚrootÚextrrrr±Ãsv  "    !            "  zPyZipFile.writepyc síd ‡fdd†}|d}|d}tjj|ddƒ}tjj|ddƒ}tjj|ddƒ}ˆjdkrðtjj|ƒrÃtj|ƒjtj|ƒjkrÃ|} } q·tjj|ƒrtj|ƒjtj|ƒjkr|} |} q·tjj|ƒrMtj|ƒjtj|ƒjkrM|} |} q·tjj|ƒr’tj|ƒjtj|ƒjkr’|} |} q·||ƒrãt j j d kr¹|} n!t j j dkrÔ|} n|} |} q·|} } nLjjd kr|} |} nT|} ˆjdkr,|} n6ˆjdkrD|} nd j ˆjƒ} t | ƒ‚tjj| ƒo•tj| ƒjtj|ƒjks·||d ˆjƒs·|} } tjj| ƒ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). rcsddl}ˆjr"td|ƒy|j|ddd|ƒWn9|jk rz}zt|jƒdSWYdd}~XnXdS)NrZ CompilingÚdoraiseTr¨F)Ú py_compiler(r?rÚPyCompileErrorÚmsg)rär¨r¹Úerr)rvrrÚ_compiles    z)PyZipFile._get_codename.._compilez.pyz.pycÚ optimizationryrrz"invalid value for 'optimize': {!r}r¨z%s/%srzrz)Ú importlibÚutilÚcache_from_sourcer§rorsr¬r~r™rsrOr¨Úformatrrr~) rvr²r³r½Zfile_pyZfile_pycZ pycache_opt0Z pycache_opt1Z pycache_opt2r€rnr»Z archivenamer)rvrr­s`  $ $ $ $          $ zPyZipFile._get_codenamerz)rrrrrrwr±r­rrrrr ºs Qc s«ddl}|jdƒ}|dkr:tjdd…}| sQ|ddkrht|ƒtjdƒ|ddkrËt|ƒdkr¡t|ƒtjdƒt|dd ƒ�}|jƒWdQRXnÜ|ddkrSt|ƒdkrt|ƒtjdƒt|dd ƒ�}|j ƒ}WdQRX|rFtd j |ƒƒtd ƒnT|ddkr½t|ƒd krŒt|ƒtjdƒt|dd ƒ�}|j |dƒWdQRXnê|ddkr§t|ƒd kröt|ƒtjdƒ‡fd d†‰t|ddƒ�‰}x|dd…D]m}t j j|ƒ}|skt j jt j j|ƒƒ}|dt jt jfkrŒ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ú-trr z.The following enclosed file is corrupted: {!r}z Done testingrcsœtjj|ƒr(|j||tƒnptjj|ƒr˜|rP|j||ƒxEtj|ƒD]4}ˆ|tjj||ƒtjj||ƒƒq`WdS)N)rorsr¬rërrƒr®r€)ÚzfrsÚzippathZnm)ÚaddToZiprrrÉ•szmain..addToZipr!ry)rÃrÄrÅrÆ)ÚtextwrapÚdedentrsÚargvr?Úexitr7r rZr\rÂrvrorsr³rŠr‡rˆ)ÚargsrÊZUSAGErÇZbadfilersrÈr)rÉrÚmaingsT               rÏÚ__main__)}rrrorÚimportlib.utilr¿rsr—r~rŽr8Zbinasciir0Ú ImportErrorÚdummy_threadingrÒrýrÓr¿Ú__all__Ú Exceptionrr rrr…r’rcrrrrrurˆr‰rŠrLrRrQr‡rPr?r@rArBrCrDrErWr@rArDrFrCrEZ_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_SIZErGrIrJZ_CD_DISK_NUMBER_STARTZ_CD_INTERNAL_FILE_ATTRIBUTESZ_CD_EXTERNAL_FILE_ATTRIBUTESrKrŒr�rjrkZ_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_SIZErlrmr:r;r6r=r>r<Z_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.r rLr+Úobjectr r¤r»rÆr|rÕrÚrÞrßrêrrìr r rÏrrrrrÚs.                         + =²=   ÿ ÿÿû­B