PNG  IHDR;IDATxܻn0K )(pA 7LeG{ §㻢|ذaÆ 6lذaÆ 6lذaÆ 6lom$^yذag5bÆ 6lذaÆ 6lذa{ 6lذaÆ `}HFkm,mӪôô! x|'ܢ˟;E:9&ᶒ}{v]n&6 h_tڠ͵-ҫZ;Z$.Pkž)!o>}leQfJTu іچ\X=8Rن4`Vwl>nG^is"ms$ui?wbs[m6K4O.4%/bC%t Mז -lG6mrz2s%9s@-k9=)kB5\+͂Zsٲ Rn~GRC wIcIn7jJhۛNCS|j08yiHKֶۛkɈ+;SzL/F*\Ԕ#"5m2[S=gnaPeғL lذaÆ 6l^ḵaÆ 6lذaÆ 6lذa; _ذaÆ 6lذaÆ 6lذaÆ RIENDB`  mYB@sXdZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z yddl Z Wne k rddlZ YnXyddlZejZWn!e k rdZe jZYnXyddlZWne k rdZYnXyddlZWne k rAdZYnXddddddd d d d d dg ZGdddeZGdddeZeZZdd>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'e3Z5dZ6dZ7dZ8dZ9dZ:d Z;d!Z<d"Z=dZ>d#Z?d&Z@d'ZAdZBd(ZCdZDd)ZEdZFd*ZGd+ZHd,ZId-ZJe j'eIZKdZLdZMdZNdZOdZPd ZQd!ZRd"ZSdZTd#ZUd&ZVd'ZWd.ZXd/ZYe j'eXZZd0Z[d1Z\e j'e[Z]dZ^dZ_dZ`dZadZbd Zcd!Zdd"ZedZfd#Zgd2d3Zhd4d Zid5d6Zjd7d8ZkGd9d d elZmGd:d;d;ZnGd<d=d=ZoGd>d?d?Zpdd@ddAddBddBddBd dBd!dCd"dDddEd#dFd&dCddGddHd+dIdJdKdLdMdNdOiZqdPdQZrdRdSZsdTdUZtGdVdWdWZuGdXdYdYZvGdZd[d[ejwZxGd\d d ZyGd]d d eyZzdd^d_Z{e|d`krTe{dS)azP 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 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) _EndRecDataOSError)fprrr_check_zipfiles   r.cCsid}yJt|dr*td|}n%t|d}t|}WdQRXWntk rdYnX|S)zQuickly 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. Freadr-rbN)hasattrr.openr,)filenameresultr-rrrr s cCsoy|j|tdWntk r0|SYnX|jt}t|tkrV|Stjt|\}}}}|tkr|S|dks|dkrt 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)seeksizeEndCentDir64Locatorr,r/lenstructunpackstructEndArchive64LocatorstringEndArchive64LocatorrsizeEndCentDir64structEndArchive64stringEndArchive64_ECD_SIGNATURE_ECD_DISK_NUMBER_ECD_DISK_START_ECD_ENTRIES_THIS_DISK_ECD_ENTRIES_TOTAL _ECD_SIZE _ECD_OFFSET)fpinoffsetendrecdatasigZdisknoZreloffZdisksZszcreate_versionZ read_versionZdisk_numZdisk_dirZdircountZ dircount2ZdirsizeZ diroffsetrrr _EndRecData64s6    0        rLc Cs|jdd|j}y|jt dWntk rIdSYnX|j}t|tkr|ddtkr|d ddkrtjt |}t |}|j d|j |tt |t |St |d td}|j|d|j}|jt}|dkr|||t}t|tkrYdSt tjt |}|t}||t|t|}|j ||j ||t |||||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.rrNr srri)r5tellsizeEndCentDirr,r/r7stringEndArchiver8r9structEndArchivelistappendrLmaxrfind_ECD_COMMENT_SIZE) rFZfilesizerIrHZmaxCommentStartstartZrecDataZ commentSizecommentrrrr+s>          r+c@saeZdZdZd$Zdd%ddZddZdddZd d!Zd"d#Z dS)&r z>Class with attributes describing each file in the ZIP archive. orig_filenamer3 date_time compress_typerYextra create_systemrKextract_versionreserved flag_bitsvolume internal_attr external_attr header_offsetCRC compress_size file_size _raw_timeZNoNamerrcCs||_|jtd}|dkr:|d|}tjdkrmtj|krm|jtjd}||_||_|ddkrtdt |_ d|_ d|_ t jdkrd|_n d|_t|_t|_d|_d|_d|_d|_d|_dS)Nr/iz+ZIP does not support timestamps before 1980rMwin32r)rZfindchrossepreplacer3r[ ValueErrorrr\rYr]sysplatformr^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 ddk}| s|j r|jd |j | s|j r!|jtks |j |j kr!|jd |j |jd d j |S)Nz<%s filename=%rz compress_type=%sriz filemode=%rz external_attr=%#xrrkz file_size=%rz compress_size=%r>) __class__rr3r\rrTcompressor_namesgetrdstatfilemoderhrgjoin)rvr4hiloisdirrrr__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}|rd } |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.rir$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|dr|j|_td|_n d|_dS)NFrMrUrrf)_fileobj _decrypter_close_fileobjr\_compress_typerg_compress_leftrh_leftr _decompressor_eof _readbuffer_offset _universalnewlinesmoder3namer1rf _expected_crccrc32 _running_crc)rvrrzipinfoZ decrypterZ close_fileobjrrrrws(             zZipExtFile.__init__cCsd|jj|jjfg}|jsz|jd|j|jf|jtkr|jdt j |j|jn |jd|jddj |S)Nz<%s.%sz name=%r mode=%rz compress_type=%sz [closed]rxry) r{rrclosedrTrrrrr|r}r)rvr4rrrrs      zZipExtFile.__repr__cCs|j ra|dkra|jjd|jd}|dkra|j|j|}||_|S|js}tjj||Sd}x|dkst||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}qW|S) zrRead and return a line from the stream. If limit is specified, at most limit bytes will be read. rs rrMrnewlineNchunk)rrrmrioBufferedIOBasereadliner7peekPATTERNsearchgrouprrT)rvlimitrlineZ readaheadmatchrrrrrrs8   !     zZipExtFile.readlinecCs|t|j|jkr~|j|}t||jkri||j|jd|_d|_n|jt|8_|j|j|jdS)z6Returns buffered bytes without advancing the position.Nri)r7rrr/)rvrrrrrr%s zZipExtFile.peekcCsdS)NTr)rvrrrreadable2szZipExtFile.readablecCsm|dks|dkrj|j|jd}d|_d|_x#|jse||j|j7}qCW|S||j}|t|jkr|j|j|}||_|S|t|j}|j|jd}d|_d|_x||dkrh|j rh|j|}|t|krK||_||_||d|7}P||7}|t|8}qW|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.. NrrM)rrr_read1MAX_Nr7)rvrbufendrIrrrr/5s4          zZipExtFile.readcCsZ|jdkrdSt||j|_|jrV|j|jkrVtd|jdS)NzBad CRC-32 for file %r)rrrrrr)rvnewdatarrr _update_crcVs zZipExtFile._update_crccCsp|dks|dkrw|j|jd}d|_d|_x0|jsr|j|j}|rC||7}PqCW|S||j}|t|jkr|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)rrrr r r7)rvrr rIrrrrread1`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_|jdkrd|_|j||S)NrrMT)rrrrunconsumed_tailr7_read2rrrU MIN_READ_SIZErrrrr)rvrrIrrrr s2      zZipExtFile._read1cCs|jdkrdSt||j}t||j}|jj|}|jt|8_|sjt|jdk rt t |j|}|S)NrrM) rrUrminrr/r7EOFErrorrbytesmap)rvrrIrrrrszZipExtFile._read2c s/z|jr|jjWdtjXdS)N)rrrsuper)rv)r{rrrs zZipExtFile.closei@rzrz)rrrrr rrecompilerrwrrrr r/rrr rrrr)r{rrs  2 ! % $ rc@seZdZdZdZdZdedddZddZd d Z d d Z d dZ ddZ ddZ dddZddZddZddZeddZejddZdddZddd d!Zddd"d#Zdddd$d%Zed&d'Zd(d)Zd*d+Zddd,d-Zdd.d/Zd0d1Zd2d3Z d4d5Z!d6d7Z"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. NrTcCs|dkrtdt|||_d|_d|_i|_g|_||_||_d|_ d |_ t |t r#d|_ ||_dd dd dd dd d d d dd di}||}xyytj|||_Wn.tk r||kr||}wYnXPqWn'd|_ ||_t|dd|_d|_tj|_d|_yD|dkr|jn'|dkr/d|_y|jj|_Wn<ttfk rt|j|_d|_d|_YqXy|jj|jWqttfk r+d|_YqXn|dkry!|j|jj|jWqtk r|jjddd|_|jj|_YqXn tdWn*|j}d|_|j |YnXdS)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'FrNrMr0zw+bzx+bzr+bwbxbrrTrz"Mode must be 'r', 'w', 'x', or 'a')rrrr )rr)!rr _allowZip64 _didModifydebug NameToInfofilelistrrr_comment isinstancestr _filePassedr3rr2r-r,getattr _fileRefCnt threadingRLockr _seekable_RealGetContentsrO start_dirAttributeErrorrr5r_fpclose)rvrrr allowZip64ZmodeDictrr-rrrrws|                                  zZipFile.__init__cCs|S)Nr)rvrrr __enter__)szZipFile.__enter__cCs|jdS)N)r)rvtypevalue tracebackrrr__exit__,szZipFile.__exit__cCsd|jj|jjfg}|jdk r|jrN|jd|jn#|jdk rq|jd|j|jd|jn |jd|jddj|S)Nz<%s.%sz file=%rz filename=%rz mode=%rz [closed]rxry) r{rrr-r+rTr3rr)rvr4rrrr/s    zZipFile.__repr__cCs|j}yt|}Wntk r9tdYnX|sLtd|jdkret||t}|t}|t|_ |t ||}|t t kr|t t8}|jdkr||}td||||||_|j|jd|j|}tj|}d}xi||kr|jt} t| tkrbtdtjt| } | ttkrtd|jdkrt| |j| t} | d} | d @r| jd } n| jd } t| } |j| t| _|j| t | _!| t"| _#| dd \ | _$| _%| _&| _'| _(| _)} }| _*| _+| _,| j&t-krt.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-8cp437rzzip file version %.1fr%r(r*r$irr&rtotalN)9r-r+r,rr%printrDrE _ECD_COMMENTr( _ECD_LOCATIONr?r>r<r6r2r5r/rBytesIOsizeCentralDirr7r8r9structCentralDir _CD_SIGNATUREstringCentralDir_CD_FILENAME_LENGTHdecoder _CD_EXTRA_FIELD_LENGTHr]_CD_COMMENT_LENGTHrY_CD_LOCAL_HEADER_OFFSETrerKr^r_r`rar\rfrgrhMAX_EXTRACT_VERSIONrrbrcrdrir[rr'rTr&r3)rvr-rHZsize_cdZ offset_cdconcatZinferredrIr<centdirr3flagsrtdrrrr1=sp                L" & "zZipFile._RealGetContentscCsdd|jDS)z+Return a list of file names in the archive.cSsg|]}|jqSr)r3).0rIrrr s z$ZipFile.namelist..)r')rvrrrnamelistszZipFile.namelistcCs|jS)zJReturn a list of class ZipInfo instances for files in the archive.)r')rvrrrinfolistszZipFile.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 Sizerz%d-%02d-%02d %02d:%02d:%02dNr"z %-46s %s %12d)rTrUrV)r=r'r[r3rh)rvrzinfoZdaterrrprintdirs  zZipFile.printdircCssd}xf|jD][}y9|j|jd}x|j|rFq4WWdQRXWqtk rj|jSYqXqWdS)z%Read all the files and check the CRC.rrrNi)r'r2r3r/r)rvZ chunk_sizerWfrrrtestzips 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)rvrinforrrgetinfos   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 TypeErrorr7r)rvrrrr setpasswords  zZipFile.setpasswordcCs|jS)z.The comment text associated with the ZIP file.)r()rvrrrrYszZipFile.commentcCst|ts%tdt|t|tkrjddl}|jdtdd|dt}||_d|_ dS)Nzcomment: expected bytes, got %srz3Archive comment is too long; truncating to %d bytes stacklevelrT) r)rr^r7r7ZIP_MAX_COMMENTwarningswarnr(r$)rvrYrbrrrrYs   c Cs-|j|d|}|jSWdQRXdS)z)Return file bytes (as a string) for name.rN)r2r/)rvrrr-rrrr/sz ZipFile.readc Cs|dkrtdd|krCddl}|jdtd|rot|t rotd t||jstd 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@rtd|jd@rtd|jd@r|jd} n|jd} | |jkrtd|j|f|jd @} d} | r|s|j}|s-td|t |} |jd} t!t"| | dd} |jd@r|j#d?d@}n|j$d?d@}| d|krtd|t%|||| dSWn|j&YnXdS)z#Return file-like object for 'name'.rrrUz&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 extractionrrrrr&zBad password for fileT)rrrd)'rrbrcDeprecationWarningr)rr^r7r-r r]r-rrer4rr/sizeFileHeaderr7rr8r9r _FH_SIGNATUREr_FH_FILENAME_LENGTH_FH_EXTRA_FIELD_LENGTHrarrFrZrrrSrrirfrr)rvrrrrbrWZzef_fileZfheaderfnameZ fname_strZ is_encryptedZzdrhZ check_byterrrr2sr         !              z ZipFile.opencCsIt|ts|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]rogetcwd_extract_member)rvmemberpathrrrrextract+s   zZipFile.extractcCs@|dkr|j}x!|D]}|j|||qWdS)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)rRrr)rvrqmembersrrrrr 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|]}|jdVqdS).N)rstrip)rPrrrr Osz1ZipFile._sanitize_windows_name..css|]}|r|VqdS)Nr)rPrrrrrxQs)!_windows_illegal_name_trans_tabler* maketransr7 translatesplitr)clsarcnamepathseprZillegalrrr_sanitize_windows_nameEs  zZipFile._sanitize_windows_namecs|jjdtjj}tjjrE|jtjjtjj}tjj|d}dtjjtjjftjjj fdd|j tjjD}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)rPr)invalid_path_partsrrrxbsz*ZipFile._extract_member..\rr!Nrz)r3rqrorqrpaltsep splitdrivecurdirpardirrr|rnormpathdirnameexistsmakedirsrmkdirr2shutil copyfileobj)rvrpZ targetpathrr~Z upperdirssourcetargetr)rrroTs* 7  zZipFile._extract_membercCs|j|jkr8ddl}|jd|jdd|jdkrStd |jshtd t|j|j sd}t |j t krd }n-|j tkrd }n|jtkrd }|rt|ddS)z6Check for errors before writing a file to the archive.rNzDuplicate name: %rr`rrrr 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)rrr )r3r&rbrcrrr-rr\r#r7r'ZIP_FILECOUNT_LIMITrhrrer )rvrWrbrequires_zip64rrr _writecheck{s(        zZipFile._writecheckcCs|jstdtj|}tj|j}tj|j}|dd}|dkrj|}tj j tj j |d}x0|dtj tj fkr|dd}qW|r|d7}t||}|dd@d>|_|rt|_n$|dkr |j|_n ||_|j|_d|_|jU|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}|sP|t,|}t-|| } | r| j.|}| t,|} |jj%|qWWdQRX| rm| j/}| t,|} |jj%|| |_n ||_| |_ ||_|jd @r| rdnd}|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|jd }d }n|j}|j}|jtkr|j|jd }n |j}|j} d} |rJtj d d t |dd t ||| } t } |j t krktt| } n|j tkrtt| } t| |j} t| |j} y|j\} }tj tt| |j| |j||j |||j||t | t | t |jd|j|j|}Wntk rttt| |j| |j|j|j |||j||t |j t | t |jd|j|j|fdt!j"YnX|j#j$||j#j$| |j#j$| |j#j$|jq W|j#j%}t |j}||j&}|j&}d}|t'kr\d}n'|tkrqd}n|tkrd}|r7|j(st)|dtj 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#j2dS)Nrir$rr!rrr&r lzr:r;rrRrQr(r)rvrWrrrr]rhrgreZ extra_datarr_rKr3rarLZpos2Z centDirCountZ centDirSizeZ centDirOffsetrZ zip64endrecZ zip64locrecrHrrrrNs &&            !            zZipFile._write_end_recordcCs1|jd8_|j r-|j r-|jdS)Nr)r-r+r)rvr-rrrr4szZipFile._fpclose)#rrrrr-ryrrwr6r:rr1rRrSrXrZr]r_propertyrYsetterr/r2rrrt classmethodrrorrrrrrr4rrrrr s: T    N    X  ' h?   ec@sLeZdZdZdedd ddZddd d Zd d ZdS)r zDClass to create ZIP archives with Python library files and packages.rTrc Cs/tj||d|d|d|||_dS)Nrrr5)r rw _optimize)rvrrrr5optimizerrrrwszPyZipFile.__init__ryNcCs|rR|| rR|jrNtjj|r4dnd}td||fdStjj|\}}tjj|r1tjj|d}tjj|rP|rd||f}n|}|jrtd|d||j|d d|\}} |jrtd | |j || tj |} | j dx| D]} tjj|| } tjj | \} }tjj| rtjjtjj| drI|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|ddd krStd|j|d d|\}} |jrtd| |j || 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. rqrz%s "%s" skipped by filterfuncNz __init__.pyz%s/%szAdding package inasrrZAdding filterfuncz.pyzfile "%s" skipped by filterfunczAdding files from directoryz.Files added with writepy() must end with ".py"z Adding filerrrr)r%rorqrr=r|risfile _get_codenamerlistdirremovesplitextwritepyr)rvpathnamebasenamerZlabeldirrZinitnamerlr~dirlistr3rqrootextrrrrsv  "    !            "  zPyZipFile.writepyc sd fdd}|d}|d}tjj|dd}tjj|dd}tjj|dd}jdkrtjj|rtj|jtj|jkr|} } qtjj|rtj|jtj|jkr|} |} qtjj|rMtj|jtj|jkrM|} |} qtjj|rtj|jtj|jkr|} |} q||rt j j d kr|} n!t j j dkr|} n|} |} q|} } njd kr|} |} nT|} jdkr,|} n6jdkrD|} nd j j} t | tjj| otj| jtj|jks||d js|} } 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). rcsddl}jr"td|y|j|ddd|Wn9|jk rz}zt|jdSWYdd}~XnXdS)NrZ CompilingdoraiseTrF) py_compiler%r=rPyCompileErrormsg)rrrerr)rvrr_compiles    z)PyZipFile._get_codename.._compilez.pyz.pyc optimizationryrrz"invalid value for 'optimize': {!r}rz%s/%srzrz) importlibutilcache_from_sourcerrorqrr~rrsrMrformatrrr|) rvrrrZfile_pyZfile_pycZ pycache_opt0Z pycache_opt1Z pycache_opt2r~rlrZ archivenamer)rvrrs`  $ $ $ $          $ zPyZipFile._get_codenamerz)rrrrrrwrrrrrrr s Qc sddl}|jd}|dkr:tjdd}| sQ|ddkrht|tjd|ddkrt|dkrt|tjdt|dd }|jWdQRXn|ddkrSt|dkrt|tjdt|dd }|j }WdQRX|rFtd j |td nT|ddkrt|d krt|tjdt|dd }|j |dWdQRXn|ddkrt|d krt|tjdfd dt|dd}x|ddD]m}t j j|}|skt j jt j j|}|dt jt jfkrd}|||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-trrz.The following enclosed file is corrupted: {!r}z Done testingrcstjj|r(|j||tnptjj|r|rP|j||xEtj|D]4}|tjj||tjj||q`WdS)N)rorqrrrrrr)zfrqzippathZnm)addToZiprrrszmain..addToZiprry)rrrr)textwrapdedentrsargvr=exitr7r rXrZrrtrorqrrrr)argsrZUSAGErZbadfilerqrr)rrmaingsT               r__main__)}rrrorimportlib.utilrrsrr~rr8Zbinasciir. ImportErrordummy_threadingrrrr__all__ Exceptionrr rrrrrarrrrrurrrrJrRrQrrPr?r@rArBrCrDrErWr>r?rBrDrArCZ_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_SIZErErGrHZ_CD_DISK_NUMBER_STARTZ_CD_INTERNAL_FILE_ATTRIBUTESZ_CD_EXTERNAL_FILE_ATTRIBUTESrIrrrhriZ_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_SIZErjrkr: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 rrrr|rrrrrrrr r rrrrrrs.                         + ==    B