MINI MINI MANI MO

Path : /usr/lib64/python3.6/__pycache__/
File Upload :
Current File : //usr/lib64/python3.6/__pycache__/zipfile.cpython-36.pyc

3


 \)2@sdZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZyddlZWne
k
r|ddlZYnXyddlZejZWne
k
rdZejZYnXyddlZWne
k
rdZYnXyddlZWne
k
rdZYnXddddddd	d
ddd
dgZGdddeZGdddeZeZZdfZdhZdjZdZdZdZdZdZ 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#Zgd2Zhe
jid3Zjd4d5Zkd6d7Zld8d
Zmd9d:Znd;d<ZoGd=ddepZqGd>d?d?ZrGd@dAdAZsGdBdCdCZtdDdEdFdFdFdFdGdHdIdJdGdKdLdMdNdOdPdQZudRdSZvdTdUZwdVdWZxGdXdYdYZyGdZd[d[ZzGd\d]d]ej{Z|Gd^d_d_ej{Z}Gd`ddZ~Gdad
d
e~ZdkdbdcZeddkredS)lzP
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@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<HHc
Cstj}d}g}d}}xf|dt|kr|||||d\}}|d|}	||krv||krn|j||||	}d}|	}qW|s|Sdj|S)NFrr T)_EXTRA_FIELD_STRUCTunpacklenappendjoin)
extraZxidsr-ZmodifiedbufferstartiZxidZxlenjrrr_strip_extras r6cCs*yt|rdSWntk
r$YnXdS)NTF)_EndRecDataOSError)fprrr_check_zipfilesr:cCsVd}y8t|drt|d}nt|d}t|}WdQRXWntk
rPYnX|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.
    Fread)r9rbN)hasattrr:openr8)filenameresultr9rrrr	s
cCsy|j|tdWntk
r(|SX|jt}t|tkrD|Stjt|\}}}}|tkrd|S|dkst|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)seeksizeEndCentDir64Locatorr8r;r.structr-structEndArchive64LocatorstringEndArchive64LocatorrsizeEndCentDir64structEndArchive64stringEndArchive64_ECD_SIGNATURE_ECD_DISK_NUMBER_ECD_DISK_START_ECD_ENTRIES_THIS_DISK_ECD_ENTRIES_TOTAL	_ECD_SIZE_ECD_OFFSET)fpinoffsetendrecdataZsigZdisknoZreloffZdisksZszcreate_versionZread_versionZdisk_numZdisk_dirZdircountZ	dircount2ZdirsizeZ	diroffsetrrr
_EndRecData64s6

 rUc	Csf|jdd|j}y|jtdWntk
r:dSX|j}t|tkr|ddtkr|d	ddkrtjt	|}t
|}|jd|j|tt|t|St
|d
td}|j|d|j}|jt}|dkrb|||t}t|tkrdSt
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 sr+rri)rAtellsizeEndCentDirr8r;r.stringEndArchiverCr-structEndArchivelistr/rUmaxrfind_ECD_COMMENT_SIZE)	rPZfilesizerSrRZmaxCommentStartr3ZrecDataZcommentSizecommentrrrr7s>



r7c@sVeZdZdZd(Zd*ddZddZd+ddZd d!Zd"d#Z	e
d,d$d%Zd&d'ZdS)-r
z>Class with attributes describing each file in the ZIP archive.
orig_filenamer?	date_time
compress_typer_r1
create_systemrTextract_versionreserved	flag_bitsvolume
internal_attr
external_attr
header_offsetCRC
compress_size	file_size	_raw_timeNoNamerrcCs||_|jtd}|dkr(|d|}tjdkrJtj|krJ|jtjd}||_||_|ddkrjtdt	|_
d|_d|_t
jdkrd|_nd|_t|_t|_d|_d|_d|_d|_d|_dS)Nr/iz+ZIP does not support timestamps before 1980r+Zwin32r)r`findchrossepreplacer?ra
ValueErrorrrbr_r1sysplatformrcDEFAULT_VERSIONrTrdrerfrgrhri)selfr?raZ	null_byterrr__init__Ws.
zZipInfo.__init__cCsd|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=%sriz filemode=%rz external_attr=%#xz
 file_size=%rz compress_size=%r>)	__class__rr?rbrr/compressor_namesgetristatfilemodeis_dirrmrlr0)r{r@hiloisdirrrr__repr__s(




zZipInfo.__repr__NcCs||j}|ddd>|dd>B|dB}|dd>|d	d>B|ddB}|jd
@rfd}}}n|j}|j}|j}|j}d}	|dkr|tkp|tk}|rd}
|tj|
dtj	|
d	||}|tks|tkr|st
d
d}d}t}	|jt
krtt|	}	n|jtkrtt|	}	t|	|j|_t|	|j|_|j\}}tjtt|j|j||j|||||t|t|
}
|
||S)z-Return the per-file header as a bytes object.rir$rr!rrr&r rNz<HHQQz'Filesize would require ZIP64 extensionsl)rarfrkrlrmr1ZIP64_LIMITrCpackcalcsizer

ZIP64_VERSIONrbrr\
BZIP2_VERSIONrLZMA_VERSIONrdrT_encodeFilenameFlagsstructFileHeaderstringFileHeaderrer.)r{zip64dtdosdatedostimerkrlrmr1min_versionfmtr?rfheaderrrr
FileHeadersF$$



zZipInfo.FileHeadercCs>y|jjd|jfStk
r8|jjd|jdBfSXdS)Nasciizutf-8i)r?encoderfUnicodeEncodeError)r{rrrrszZipInfo._encodeFilenameFlagscCs(|j}tj}xt|dkr"|d|dd\}}|dkr|dkrZ|d|dd}nV|dkrv|d|dd	}n:|d
kr|d|dd}n|d
krf}ntd||fd
}|jdkr|||_|d7}|jdkr|||_|d7}|jdkr|j}|||_|d7}||dd}qWdS)Nr z<HHrz<QQQrz<QQrrz<Qrrz"Corrupt extra field %04x (size=%d))rr)r1rCr-r.rrmrlrj)r{r1r-tplnZcountsidxoldrrr_decodeExtras4





zZipInfo._decodeExtracCst|tjrtj|}tj|}tj|j}tj|j	}|dd}|dkrP|}tj
jtj
j|d}x$|dtj
tjfkr|dd}qjW|r|d7}|||}|jd@d>|_|rd|_|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"Nrrqir)
isinstancertPathLikefspathrS_ISDIRst_modetime	localtimest_mtimepathnormpath
splitdriverualtseprirmst_size)clsr?arcnamestrmtimerazinforrr	from_files(



zZipInfo.from_filecCs|jddkS)z2Return True if this archive member is a directory.rrq)r?)r{rrrrszZipInfo.is_dir)r`r?rarbr_r1rcrTrdrerfrgrhrirjrkrlrmrnrprrrrr)ror)N)N)
rrrr	__slots__r|rrrrclassmethodrrrrrrr
>s8
*
.$!c@s<eZdZdZddZdZddZddZd	d
Zdd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}xTtdD]H}|}x6tdD]*}|d@rH|d?d@|A}q*|d?d@}q*W|||<qW|S)zGenerate 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[rrri)range)Zpolytabler4crcr5rrr_GenerateCRCTable#s
z_ZipDecrypter._GenerateCRCTableNcCs|d?d@|j||Ad@AS)z(Compute the CRC32 primitive on one byte.ri)crctable)r{Zchrrrr_crc327sz_ZipDecrypter._crc32cCsBtjdkrtjt_d|_d|_d|_x|D]}|j|q,WdS)NixV4igE#ixV4)rrrkey0key1key2_UpdateKeys)r{pwdprrrr|;s


z_ZipDecrypter.__init__cCsX|j||j|_|j|jd@d@|_|jddd@|_|j|jd?d@|j|_dS)Nrlirr)rrrr)r{crrrrDsz_ZipDecrypter._UpdateKeyscCs>t|tst|jdB}|||dAd?d@A}|j||S)zDecrypt a single character.rrrr)rintAssertionErrorrr)r{rkrrr__call__Js


z_ZipDecrypter.__call__)
rrrrrrrr|rrrrrrrs	rc@s,eZdZddZddZddZddZd	S)
LZMACompressorcCs
d|_dS)N)_comp)r{rrrr|UszLZMACompressor.__init__cCsFtjdtji}tjtjtjtj|gd|_tjdddt	||S)Nid)filtersz<BBHr$r )
lzmaZ_encode_filter_propertiesFILTER_LZMA1r
FORMAT_RAW_decode_filter_propertiesrrCrr.)r{Zpropsrrr_initXszLZMACompressor._initcCs*|jdkr|j|jj|S|jj|S)N)rrcompress)r{rSrrrr_s
zLZMACompressor.compresscCs&|jdkr|j|jjS|jjS)N)rrflush)r{rrrrds
zLZMACompressor.flushN)rrrr|rrrrrrrrSsrc@seZdZddZddZdS)LZMADecompressorcCsd|_d|_d|_dS)Nr+F)_decomp_unconsumedeof)r{rrrr|lszLZMADecompressor.__init__cCs|jdkr|j|7_t|jdkr*dStjd|jdd\}t|jd|krXdStjtjtjtj	|jdd|gd|_|jd|d}|`|jj
|}|jj|_|S)Nr r+z<Hr)r)rrr.rCr-rrrrr
decompressr)r{rSZpsizer@rrrrqs

zLZMADecompressor.decompressN)rrrr|rrrrrrjsrZstoreZshrinkreduceZimplodetokenizeZdeflateZ	deflate64Zbzip2rZterseZlz77ZwavpackZppmd)rrrrr r!r"r#rr$r%rrr*abcCsX|tkr
nJ|tkr tsTtdn4|tkr6tsTtdn|tkrLtsTtdntddS)Nz.Compression requires the (missing) zlib modulez-Compression requires the (missing) bz2 modulez.Compression requires the (missing) lzma modulez(That compression method is not supported)	rrzlibRuntimeErrorrbz2rrNotImplementedError)compressionrrr_check_compressionsrcCs@|tkrtjtjtjdS|tkr*tjS|tkr8t	SdSdS)Nr(i)
rrZcompressobjZZ_DEFAULT_COMPRESSIONZDEFLATEDrrZ
BZ2Compressorrr)rbrrr_get_compressors
rcCsn|tkrdS|tkrtjdS|tkr.tjS|tkr<tSt	j
|}|r\td||fntd|fdS)Nr(zcompression type %d (%s)zcompression type %di)rrrZ
decompressobjrrZBZ2Decompressorrrrrr)rbZdescrrrr_get_decompressors

rc@s&eZdZddZd
ddZddZdS)_SharedFilecCs"||_||_||_||_||_dS)N)_file_pos_close_lock_writing)r{fileposcloselockZwritingrrrr|s
z_SharedFile.__init__rc	CsL|j<|jrtd|jj|j|jj|}|jj|_|SQRXdS)NzyCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.)rrrwrrArr;rW)r{nrSrrrr;sz_SharedFile.readcCs$|jdk	r |j}d|_|j|dS)N)rr)r{fileobjrrrrs
z_SharedFile.closeNr)r)rrrr|r;rrrrrrs
rc@s4eZdZddZddZddZddZd	d
ZdS)	_TellablecCs||_d|_dS)Nr)r9rQ)r{r9rrrr|sz_Tellable.__init__cCs|jj|}|j|7_|S)N)r9writerQ)r{rSrrrrrsz_Tellable.writecCs|jS)N)rQ)r{rrrrWsz_Tellable.tellcCs|jjdS)N)r9r)r{rrrrsz_Tellable.flushcCs|jjdS)N)r9r)r{rrrrsz_Tellable.closeN)rrrr|rrWrrrrrrrs
rcseZdZdZdZdZdddZd	d
Zd!ddZd"d
dZ	ddZ
d$ddZddZddZ
ddZddZfddZZS)%
ZipExtFilezZFile-like object for reading an archive member.
       Is returned by ZipFile.open().
    rriNFcCs||_||_||_|j|_|j|_|j|_t	|j|_
d|_d|_d|_
d|_|jdk	rf|jd8_||_|j|_t|dr|j|_td|_nd|_dS)NFr+rrrk)_fileobj
_decrypter_close_fileobjrb_compress_typerl_compress_leftrm_leftr
_decompressor_eof_readbuffer_offsetnewlinesmoder?namer=rk
_expected_crccrc32_running_crc)r{rrzipinfoZ	decrypterZ
close_fileobjrrrr|s&

zZipExtFile.__init__cCsvd|jj|jjfg}|jsX|jd|j|jf|jtkrb|jdt	j
|j|jn
|jd|jddj|S)Nz<%s.%sz name=%r mode=%rz compress_type=%sz	 [closed]r}r~)rrrclosedr/r	rrrrrr0)r{r@rrrr#s


zZipExtFile.__repr__cCsL|dkr>|jjd|jd}|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)rrrrioBufferedIOBasereadline)r{limitr4linerrrr1szZipExtFile.readlinecCsr|t|j|jkr\|j|}t||jkrJ||j|jd|_d|_n|jt|8_|j|j|jdS)z6Returns buffered bytes without advancing the position.Nri)r.rrr;)r{rchunkrrrpeekAs
zZipExtFile.peekcCsdS)NTr)r{rrrreadableNszZipExtFile.readablecCs|dks|dkrL|j|jd}d|_d|_x|jsF||j|j7}q.W|S||j}|t|jkr~|j|j|}||_|S|t|j}|j|jd}d|_d|_x^|dko|jr|j|}|t|kr||_||_||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..
        Nrr+)rrr_read1MAX_Nr.)r{rbufendrSrrrr;Qs4

zZipExtFile.readcCs@|jdkrdSt||j|_|jr<|j|jkr<td|jdS)NzBad CRC-32 for file %r)r
rrrrr	)r{newdatarrr_update_crcrs

zZipExtFile._update_crccCs|dks|dkrV|j|jd}d|_d|_x$|jsP|j|j}|r.||7}Pq.W|S||j}|t|jkr|j|j|}||_|S|t|j}|j|jd}d|_d|_|dkrxN|js
|j|}|t|kr||_||_||d|7}P|r||7}PqW|S)z7Read up to n bytes with at most one read() system call.Nrr+)rrrrrr.)r{rrrSrrrrread1|s>



zZipExtFile.read1cCs"|js|dkrdS|jtkrH|jj}|t|krR||j|t|7}n
|j|}|jtkrj|jdk|_nx|jtkrt	||j
}|jj||}|jjp|jdko|jj|_|jr||jj
7}n |jj|}|jjp|jdk|_|d|j}|jt|8_|jdkrd|_|j||S)Nrr+T)rrrrZunconsumed_tailr._read2rrr\
MIN_READ_SIZErrrrr)r{rrSrrrrs2





zZipExtFile._read1cCsj|jdkrdSt||j}t||j}|jj|}|jt|8_|sLt|jdk	rft	t
|j|}|S)Nrr+)rr\r minrr;r.EOFErrorrbytesmap)r{rrSrrrrs

zZipExtFile._read2c
s&z|jr|jjWdtjXdS)N)rrrsuper)r{)rrrrszZipExtFile.closei@)NFr)r)rr)r)rrrrrr r|rrrrr;rrrrr
__classcell__rr)rrrs




!
%$rcs@eZdZddZeddZddZddZfd	d
ZZ	S)
_ZipWriteFilecCs4||_||_||_t|j|_d|_d|_d|_dS)Nr)	_zinfo_zip64_zipfilerrb_compressor
_file_size_compress_size_crc)r{zfrrrrrr|sz_ZipWriteFile.__init__cCs|jjS)N)r+r9)r{rrrrsz_ZipWriteFile._fileobjcCsdS)NTr)r{rrrwritablesz_ZipWriteFile.writablecCsf|jrtdt|}|j|7_t||j|_|jrV|jj|}|jt|7_|j	j
||S)NzI/O operation on closed file.)rrwr.r-rr/r,rr.rr)r{rSnbytesrrrrsz_ZipWriteFile.writecsX|jr
dStj|jrN|jj}|jt|7_|jj||j|j	_
n
|j|j	_
|j|j	_
|j|j	_|j	jd@r|jrdnd}|jjtj|t|j	j
|j	j
|j	j|jj|j_nn|js|jtkrtd|jtkrtd|jj|j_|jj|j	j|jj|j	j|j|jj|jjd|j_|jjj|j	|j	|jj|j	j <dS)Nrz<LLQQz<LLLLz+File size unexpectedly exceeded ZIP64 limitz1Compressed size unexpectedly exceeded ZIP64 limitF)!rr%rr,rr.r.rrr)rlr-r/rkrmrfr*rCr
_DD_SIGNATURErWr+	start_dirrrrArjrrfilelistr/
NameToInfor?)r{rr)rrrrs8






z_ZipWriteFile.close)
rrrr|propertyrr1rrr'rr)rrr(s
	r(c@seZdZdZdZdZdedfddZddZd	d
Z	ddZ
d
dZddZddZ
d<ddZddZddZddZeddZejddZd=ddZd>d d!d"d#Zd?d$d%Zd@d&d'ZdAd(d)Zed*d+Zd,d-Zd.d/ZdBd0d1ZdCd2d3Zd4d5Z d6d7Z!d8d9Z"d:d;Z#dS)Dra 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.

    NrTcCsF|dkrtdt|||_d|_d|_i|_g|_||_||_d|_	d	|_
t|tj
rdtj|}t|trd|_||_d
ddd
dddd}||}x^ytj|||_Wn(tk
r||kr||}wYnXPqWnd|_||_t|dd|_d|_tj|_d|_d|_y|dkr*|jn|dkrd|_y|jj|_Wn2t tfk
r|t!|j|_d|_d|_Yn6Xy|jj"|jWn t tfk
rd|_YnXnf|dkry|j|jj"|jWn6t#k
r|jj"ddd|_|jj|_YnXntdWn$|j}d|_|j$|YnXdS)z]Open the ZIP file with mode read 'r', write 'w', exclusive create 'x',
        or append 'a'.r8wxaz+ZipFile requires mode 'r', 'w', 'x', or 'a'FrNr+r<zw+bzx+bzr+bwbZxb)r8r9r:r;zr+bzw+bzx+brr	Trz"Mode must be 'r', 'w', 'x', or 'a')r8r9r:r;)r9r:)%rwr_allowZip64
_didModifydebugr6r5rrr_commentrrtrrstr_filePassedr?rr>r9r8getattr_fileRefCnt	threadingRLockr	_seekabler_RealGetContentsrWr4AttributeErrorrrAr_fpclose)r{rrr
allowZip64ZmodeDictrr9rrrr|;s







zZipFile.__init__cCs|S)Nr)r{rrr	__enter__szZipFile.__enter__cCs|jdS)N)r)r{typevalue	tracebackrrr__exit__szZipFile.__exit__cCsd|jj|jjfg}|jdk	rd|jr8|jd|jn|jdk	rR|jd|j|jd|jn
|jd|jddj|S)Nz<%s.%sz file=%rz filename=%rz mode=%rz	 [closed]r}r~)	rrrr9rBr/r?rr0)r{r@rrrrs



zZipFile.__repr__cCs|j}yt|}Wntk
r.tdYnX|s<td|jdkrNt||t}|t}|t|_	|t
||}|ttkr|t
t8}|jdkr||}td||||||_|j|jd|j|}tj|}d}x||kr|jt}	t|	tkrtdtjt|	}	|	ttkr0td|jdkrDt|	|j|	t}
|	d}|d	@rp|
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 }|jdkrtd|qWdS)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)9r9r7r8rr?printrNrO_ECD_COMMENTr@
_ECD_LOCATIONrIrHrFrBr4rAr;rBytesIOsizeCentralDirr.rCr-structCentralDir
_CD_SIGNATUREstringCentralDir_CD_FILENAME_LENGTHdecoder
_CD_EXTRA_FIELD_LENGTHr1_CD_COMMENT_LENGTHr__CD_LOCAL_HEADER_OFFSETrjrTrcrdrerfrbrkrlrmMAX_EXTRACT_VERSIONrrgrhrirnrarr5r/r6r?)r{r9rRZsize_cdZ	offset_cdconcatZinferredrSrRcentdirr?flagsr:tdrrrrHsp









4  
zZipFile._RealGetContentscCsdd|jDS)z+Return a list of file names in the archive.cSsg|]
}|jqSr)r?).0rSrrr
<listcomp>sz$ZipFile.namelist.<locals>.<listcomp>)r5)r{rrrnamelistszZipFile.namelistcCs|jS)zJReturn a list of class ZipInfo instances for files in the
        archive.)r5)r{rrrinfolistszZipFile.infolistcCsPtdd
|dx:|jD]0}d|jdd}td	|j||jf|dqWdS)z+Print a table of contents for the zip file.z%-46s %19s %12s	File NameModified    Size)rz%d-%02d-%02d %02d:%02d:%02dNr"z
%-46s %s %12d)rjrkrl)rSr5rar?rm)r{rrZdaterrrprintdirs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.rrr8Ni)r5r>r?r;r)r{Z
chunk_sizerfrrrtestzipszZipFile.testzipcCs$|jj|}|dkr td||S)z,Return the instance of ZipInfo given 'name'.Nz(There is no item named %r in the archive)r6rKeyError)r{r	inforrrgetinfos

zZipFile.getinfocCs8|r"t|tr"tdt|j|r.||_nd|_dS)z)Set default password for encrypted files.zpwd: expected bytes, got %sN)rr#	TypeErrorrMrr)r{rrrrsetpasswords
zZipFile.setpasswordcCs|jS)z.The comment text associated with the ZIP file.)r@)r{rrrr_%szZipFile.commentcCs^t|tstdt|jt|tkrNddl}|jdtdd|dt}||_	d|_
dS)Nzcomment: expected bytes, got %srz3Archive comment is too long; truncating to %d bytesr)
stacklevelT)rr#rsrMrr.ZIP_MAX_COMMENTwarningswarnr@r>)r{r_rwrrrr_*s
c	Cs"|j|d|
}|jSQRXdS)zReturn file bytes for name.r8N)r>r;)r{r	rr9rrrr;7szZipFile.readF)force_zip64csv|d krtd|r2t|tr2tdt|j|rF|dkrFtdjsTtdt|trd|}n$|dkr~t|}j|_	n
j
|}|dkrj||dSjrtdj
d	7_
tj|jjjfd
d}y~|jt}t|tkrtdtjt|}|ttkr td
|j|t}|trF|j|t|jd@rZtd|jd@rntd|jd@r|jd}	n
|jd}	|	|j krtd|j |f|jd	@}
d}|
rL|sΈj!}|st"d|t#|}|jd}t$t%||dd}
|jd@r$|j&d?d@}n|j'd?d@}|
d|krLt"d|t(||||dS|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.
        r8r9zopen() 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)ryzyCan't read from the ZIP file while there is an open writing handle on it. Close the writing handle before trying to read.rcsjS)N)rr)r{rr<lambda>lszZipFile.open.<locals>.<lambda>zTruncated file headerz Bad magic number for file header z$compressed patched data (flag bit 5)@zstrong encryption (flag bit 6)izutf-8rQz/File name in directory %r and header %r differ.Nz6File %r is encrypted, password required for extractionrrrrrr&zBad password for file %rT>r9r8)*rwrr#rsrMrr9r
rrbrr_open_to_writerrDrrjrJrr;sizeFileHeaderr.rrCr-r
_FH_SIGNATUREr_FH_FILENAME_LENGTH_FH_EXTRA_FIELD_LENGTHrfrr\r`rrrr[r$rnrkrr)r{r	rrryrZzef_fileZfheaderfnameZ	fname_strZis_encryptedZzdrhZ
check_byter)r{rr><s~








zZipFile.opencCs|r|jrtd|jr"tdt|ds2d|_d|_d|_d|_|jt	kr\|jdO_|j
sp|jdO_|js|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.rmrrrirg?Ti)r=rwrr=rmrlrkrfrbrrGrirr9rAr4rWrj_writecheckr>rrr()r{rryrrrrr}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)rtgetcwdr_extract_member)r{memberrrrrrextracts

zZipFile.extractcCsL|dkr|j}|dkr"tj}n
tj|}x|D]}|j|||q2WdS)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)rhrtrrr)r{rmembersrr
rrr
extractalls


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)rfr:rrr	<genexpr>sz1ZipFile._sanitize_windows_name.<locals>.<genexpr>css|]}|r|VqdS)Nr)rfr:rrrrs)!_windows_illegal_name_trans_tablerA	maketransr.	translatesplitr0)rrpathseprZillegalrrr_sanitize_windows_names
zZipFile._sanitize_windows_namecsNt|ts|j|}|jjdtjj}tjjrB|jtjjtjj}tjj	|d}dtjj
tjjftjjjfdd|j
tjjD}tjjdkr|j|tjj}tjj||}tjj|}tjj|}|rtjj|rtj||jrtjj|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.
        rqrr~c3s|]}|kr|VqdS)Nr)rfr:)invalid_path_partsrrrsz*ZipFile._extract_member.<locals>.<genexpr>\)rr<N)rr
rrr?rvrtrrurrcurdirpardirr0rrrdirnameexistsmakedirsrrmkdirr>shutilcopyfileobj)r{rZ
targetpathrrZ	upperdirssourcetargetr)rrrs.

&


 zZipFile._extract_membercCs|j|jkr(ddl}|jd|jdd|jdkr:td	|jsHtd
t|j|j	sd}t
|jtkrpd}n|j
tkrd}n|jtkrd
}|rt|ddS)z6Check for errors before writing a file to the archive.rNzDuplicate name: %rr)rur9r:r;z&write() requires mode 'w', 'x', or 'a'z4Attempt to write ZIP archive that was already closedzFiles countZFilesizezZipfile sizez would require ZIP64 extensions)r9r:r;)r?r6rwrxrrwr9rrbr=r.r5ZIP_FILECOUNT_LIMITrmrrjr
)r{rrwrequires_zip64rrrr/s(



zZipFile._writecheckcCs0|jstd|jrtdtj||}|jr>d|_d|_n|dk	rN||_n|j	|_|jr|j
|jrz|jj|j
|jj|_|jtkr|jdO_|j|d|_|jj|||j|j<|jj|jd|jj|_
WdQRXn<t|d,}|j|d	}tj||dWdQRXWdQRXdS)
zLPut the bytes from filename into the archive under the name
        arcname.z7Attempt to write to ZIP archive that was already closedz>Can't write to ZIP archive while an open writing handle existsrNrTFr<r9iri )r9rwrr
rrrlrkrbrrrGrAr4rWrjrrfrr>r5r/r6r?rrr>rr)r{r?rrbrsrcdestrrrrFs8

z
ZipFile.writecCst|tr|jd}t|tspt|tjtjddd}|j|_|jddkrhd|_	|j	dO_	qtd|_	n|}|j
std
|jrtd|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?rarrqiAriz7Attempt to write to ZIP archive that was already closedz?Can't write to ZIP archive while an open writing handle exists.r9)rriAi)rrArr
rrrrbr?rir9rwrr.rmrr>r)r{Zzinfo_or_arcnamerSrbrrrrrwritestrps.



zZipFile.writestrcCs|jdS)z2Call the "close()" method in case the user forgot.N)r)r{rrr__del__szZipFile.__del__cCs||jdkrdS|jrtdzB|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.r9r:r;)r9r:r;)r9rrwrr>rrGrAr4_write_end_recordrJ)r{r9rrrrs
z
ZipFile.closecCsrxP|jD]D}|j}|ddd>|dd>B|dB}|dd>|d	d>B|ddB}g}|jtksv|jtkr|j|j|j|jd
}d
}n|j}|j}|jtkr|j|jd
}n|j}|j}	d}
|rt|	d}	t	j
ddt|dd
t|f||	}	t}
|j
tkr(tt|
}
n|j
tkr>tt|
}
t|
|j}t|
|j}yZ|j\}
}t	j
tt||j||j||j
|||j||t|
t|	t|jd|j|j|}Wnltk
rttt||j||j|j |j
|||j||t|j!t|	t|jd|j|j|ft"j#dYnX|j$j%||j$j%|
|j$j%|	|j$j%|jq
W|j$j&}t|j}||j'}|j'}d}|t(krd}n|tkrd}n|tkrd}|r*|j)st*|dt	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$j3dS)Nrir$rr!rrr&r lz<HHQr)rzFiles countzCentral directory offsetzCentral directory sizez would require ZIP64 extensions,ri)r)4r5rarmrrlr/rjr1r6rCrr.rrbrr\rrrrdrTrrXrZrcrerkr_rhriDeprecationWarningrSrfr?rxstderrr9rrWr4rr=r
rGrHrDrEr!rZrYr@r)r{rrrrr1rmrlrjZ
extra_datarrdrTr?rfrbZpos2ZcentDirCountZcentDirSizeZ
centDirOffsetrZzip64endrecZzip64locrecrRrrrrs$$



















zZipFile._write_end_recordcCs8|jdkst|jd8_|jr4|jr4|jdS)Nrr)rDrrBr)r{r9rrrrJszZipFile._fpclose)N)N)r8N)F)NN)NNN)NN)N)$rrrrr9rrr|rLrPrrHrhrirmrorrrtr7r_setterr;r>r}rrrrrrrrrrrrJrrrrr's<WN
	
		
q
+

*
*
$fc@s4eZdZdZdedd
fddZdd	d
ZddZdS)rzDClass to create ZIP archives with Python library files and packages.r8TrcCstj|||||d||_dS)N)rrrK)rr|	_optimize)r{rrrrKoptimizerrrr|szPyZipFile.__init__r~NcCstj|}|rF||rF|jrBtjj|r.dnd}td||fdStjj|\}}tjj|rntjj|d}tjj|r|rd||f}n|}|jrtd|d||j	|d	d|\}}	|jrtd|	|j
||	tj|}
|
jdx|
D]}tjj||}tjj
|\}
}tjj|rRtjjtjj|dr|j|||dq|d
kr|r||r|jrtd|q|j	|d	d|\}}	|jrtd|	|j
||	qWn|jrtd|xtj|D]}tjj||}tjj
|\}
}|d
kr|r0||r0|jrtd|q|j	|d	d|\}}	|jrZtd|	|j
||	qWnP|ddd
krtd|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.
        rrz%s %r skipped by filterfuncNz__init__.pyz%s/%szAdding package inasrrZAdding)
filterfuncz.pyzfile %r skipped by filterfunczAdding files from directoryz.Files added with writepy() must end with ".py"zAdding filerrrr)rtrr?rrrSrr0isfile
_get_codenamerlistdirremovesplitextwritepyr)r{pathnamebasenamerZlabeldirr	ZinitnamerrZdirlistr?rrootZextrrrr$sx












zPyZipFile.writepyc
sdfdd	}|d}|d}tjj|dd}tjj|dd}tjj|dd}jdkr\tjj|rtj|jtj|jkr|}	}
ntjj|rtj|jtj|jkr|}
|}	ntjj|rtj|jtj|jkr|}
|}	nvtjj|rtj|jtj|jkr|}
|}	nD||rRt	j
jd	kr4|}
nt	j
jdkrH|}
n|}
|}	n|}
}	njd	krr|}
|}	n<|}	jdkr|}
n&jdkr|}
nd
jj}t
|tjj|
otj|
jtj|jks||jds|}
}	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|dWn,|jk
rX}zt|jdSd}~XnXdS)NrZ	CompilingT)doraiserF)
py_compiler?rScompilePyCompileErrormsg)rrrerr)r{rr_compile}s

z)PyZipFile._get_codename.<locals>._compilez.pyz.pycr~)optimizationrrz"invalid value for 'optimize': {!r})rz%s/%sr)rr)	importlibutilcache_from_sourcerrtrrrrrxrcrformatrwr)
r{rrrZfile_pyZfile_pycZpycache_opt0Zpycache_opt1Zpycache_opt2rrrZarchivenamer)r{rrvs`


zPyZipFile._get_codenamer)r~N)rrrrrr|rrrrrrrs

Rcsddl}|jd}|dkr(tjdd}|s:|ddkrLt|tjd|ddkrt|dkrvt|tjdt|dd	}|jWdQRXn||ddkr
t|dkrt|tjdt|dd	}|j	}WdQRX|rtd
j
|tdn|ddkrbt|dkr8t|tjdt|dd	}|j|dWdQRXn|ddkrt|dkrt|tjdfd
dt|ddh}x`|ddD]P}tj
j|}|stj
jtj
j|}|dtjtjfkrd}|||qWWdQRXdS)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-trr8z.The following enclosed file is corrupted: {!r}zDone testingrcsptjj|r|j||tnPtjj|rl|r8|j||x2tj|D]$}|tjj||tjj||qDWdS)N)rtrrrrrrr0)r0rzippathZnm)addToZiprrrszmain.<locals>.addToZipr9r~)rrrr)textwrapdedentrxargvrSexitr.rrmrorrrtrrrrr)argsrZUSAGEr0Zbadfilerrr)rrmainsT




r__main__liiiii)N)rrrtreimportlib.utilrrxrrrrCZbinasciirEImportErrorZdummy_threadingrrrr__all__	Exceptionrr
rrrrrvrrrrrzrrrr`rZrYrrXrIrJrKrLrMrNrOr^rTrUrXrZrWrYZ_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_rrr~rZ_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_SIZErrrDrErBrGrHrFZ_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_CENTDIRr3ZStructr,r6r:r	rUr7objectr
rrrrrrrrrrrr(rrrrrrrr<module>s@









+=Y=fJy/
B


OHA YOOOO