• File: zipfile.pyc
  • Full Path: /home3/farmfre2/public_html/ALFA_DATA/alfasymlink/root/proc/self/root/proc/self/root/opt/alt/python27/lib64/python2.7/zipfile.pyc
  • Date Modified: 10/26/2026 8:10 PM
  • File size: 42.78 KB
  • MIME-type: text/x-bytecode.python
  • Charset: 8 bit

jc	@s[dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZyddlZej
Z
Wn ek
reZej
Z
nXddddddd	d
dg	ZdefdYZdefd
YZeZdd>dZdd>dZdd>dZdZdZdZdZejeZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)eje(Z*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3dZ4dZ5dZ6d Z7d!Z8d"Z9d#Z:dZ;d$Z<d%Z=d&Z>d'Z?eje>Z@dZAdZBdZCdZDdZEdZFdZGdZHdZIdZJdZKdZLd(ZMd)ZNejeMZOd*ZPd+ZQejePZRdZSdZTdZUdZVdZWdZXdZYdZZdZ[dZ\d,Z]ej^d-Z_d.Z`d/Zad0Zbd1Zcd2Zddeefd3YZfd4fd5YZgid6d6d7d6d8d6d8d6d8d6d8d6d9d6d:d6d;d6d<d6d9d6d=d 6d>d"6d?d%6d@dA6dBdC6dDdE6ZhdFe	jifdGYZjd	eefdHYZkd
ekfdIYZledJZmendKkrWemndS(Ls
Read and write ZIP files.
iNt
BadZipfileterrort
ZIP_STOREDtZIP_DEFLATEDt
is_zipfiletZipInfotZipFilet	PyZipFiletLargeZipFilecBseZRS((t__name__t
__module__(((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRscBseZdZRS(su
    Raised when writing a zipfile, the zipfile requires ZIP64 extensions
    and those extensions are disabled.
    (R	R
t__doc__(((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRsiiiiis<4s4H2LHsPKiiiiiii	s<4s4B4HL2L5H2LsPKi
iii
iiiis<4s2B4HL2L2HsPKs<4sLQLsPKs
<4sQ2H2L4QsPKiPKs<HHc
Cstj}t}g}d}}x|dt|kr||||d!\}}|d|}	||kr||kr|j|||!n|	}t}n|	}q"W|s|Sdj|S(Niit(t_EXTRA_FIELD_STRUCTtunpacktFalsetlentappendtTruetjoin(
textratxidsRtmodifiedtbuffertstarttitxidtxlentj((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt_strip_extras 	
	
cCs,yt|rtSWntk
r'nXtS(N(t_EndRecDataRtIOErrorR(tfp((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt_check_zipfiles
cCsmt}yIt|dr*td|}n$t|d}t|}WdQXWnttfk
rhnX|S(sQuickly 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.
    treadR trbN(RthasattrR!topenRR(tfilenametresultR ((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRsc
CsS|t8}|dkr|S|j||jt}t|tkrWtdntjt|\}}}}|tkr|S|dks|dkrt	dn|t
8}||krt	dn|j|||}|jt
}t|t
krtdn|jtrz||krz|j|d}|jt
}t|t
krztdqzn|jtst	dntjt
|\
}}	}
}}}
}}}}|||ks|	dt
|krt	dn||t<||t<|
|t<||t<||t<||t<||t<|||t<|S(	sM
    Read the ZIP64 end-of-archive records and use that to update endrec
    isUnknown I/O erroris3zipfiles that span multiple disks are not supporteds.Corrupt zip64 end of central directory locators/Zip64 end of central directory record not foundis-Corrupt zip64 end of central directory record(tsizeEndCentDir64LocatortseekR"RRtstructRtstructEndArchive64LocatortstringEndArchive64LocatorRtsizeEndCentDir64t
startswithtstringEndArchive64tstructEndArchive64t_ECD_SIGNATUREt_ECD_DISK_NUMBERt_ECD_DISK_STARTt_ECD_ENTRIES_THIS_DISKt_ECD_ENTRIES_TOTALt	_ECD_SIZEt_ECD_OFFSETt
_ECD_LOCATION(tfpintoffsettendrectdatatsigtdisknotrelofftdiskstextrasztsztcreate_versiontread_versiontdisk_numtdisk_dirtdircountt	dircount2tdirsizet	diroffset((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt
_EndRecData64sR





0






c	Cs|jdd|j}y|jtdWntk
rEd	SX|j}t|tkr|dd!tkr|ddkrtj	t
|}t|}|jd|j|tt
||t|St|d
td}|j|d|j}|jt}|dkr|||t!}t|tkrLd	Sttj	t
|}|t}||t|t|!}|j||j||t
||||Sd	S(sReturn 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.iiiisRiiNi(R)ttelltsizeEndCentDirRtNoneR"RtstringEndArchiveR*RtstructEndArchivetlistRRKtmaxtrfindt_ECD_COMMENT_SIZE(	R9tfilesizeR<R;tmaxCommentStartRtrecDatatcommentSizetcomment((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRs<



cBsJeZdZdZdddZd dZdZdZdZ	RS(!s>Class with attributes describing each file in the ZIP archive.t
orig_filenameR&t	date_timet
compress_typeRYRt
create_systemRCtextract_versiontreservedt	flag_bitstvolumet
internal_attrt
external_attrt
header_offsettCRCt
compress_sizet	file_sizet	_raw_timet_end_offsettNoNameiiicCs,||_|jtd}|dkr:|d|!}ntjdkrptj|krp|jtjd}n||_||_|ddkrtdnt	|_
d|_d|_t
jdkrd|_n	d|_d|_d|_d|_d|_d|_d|_d|_d|_dS(	Nit/is+ZIP does not support timestamps before 1980Rtwin32ii(RZtfindtchrtostseptreplaceR&R[t
ValueErrorRR\RYRtsystplatformR]RCR^R_R`RaRbRcRNRi(tselfR&R[t	null_byte((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt__init__Gs0														c
Cs|j}|ddd>|dd>B|dB}|dd>|d	d>B|ddB}|jd
@rsd}}}n|j}|j}|j}|j}|dkr|tkp|tk}n|rd}	|tj	|	dtj
|	d	||}n|tks|tkr_|s&tdnd
}d
}td|j
|_
td|j
|_n|j\}
}tj	tt|j
|j||j|||||t|
t|
}||
|S(s'Return the per-file header as a string.iii	iiiiiiis<HHQQs'Filesize would require ZIP64 extensionsIi-N(R[R`ReRfRgRRNtZIP64_LIMITR*tpacktcalcsizeRRRR^RCt_encodeFilenameFlagststructFileHeadertstringFileHeaderR_R\R(
Rutzip64tdttdosdatetdostimeReRfRgRtfmtR&R`theader((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt
FileHeaderrs:	&&
				#cCstt|jtr`y|jjd|jfSWqptk
r\|jjd|jdBfSXn|j|jfSdS(Ntasciisutf-8i(t
isinstanceR&tunicodetencodeR`tUnicodeEncodeError(Ru((s,/opt/alt/python27/lib64/python2.7/zipfile.pyR{s
!cCs(|jd@r|jjdS|jSdS(Nisutf-8(R`R&tdecode(Ru((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt_decodeFilenames
cCs|j}tj}xjt|dkr~|d|d \}}|dkrm|dkrq|d|dd!}no|dkr|d|dd	!}nJ|d
kr|d|dd!}n%|d
krd}ntd|fd
}|jdkr|||_|d7}n|jdkr8|||_|d7}n|jdkrm|j}|||_|d7}qmn||d}qWdS(Nis<HHiis<QQQiis<QQiis<QiisCorrupt extra field %sll((ll(RR*RRtRuntimeErrorRgRfRd(RuRRttptlntcountstidxtold((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt_decodeExtras4			



	
(RZR&R[R\RYRR]RCR^R_R`RaRbRcRdReRfRgRhRi(iiiiiiN(
R	R
Rt	__slots__RwRNRR{RR(((s,/opt/alt/python27/lib64/python2.7/zipfile.pyR-s4+'			t
_ZipDecryptercBsDeZdZdZeZdZdZdZdZRS(sClass 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)
    cCsd}dgd}xhtdD]Z}|}xAtdD]3}|d@r^|d?d@|A}q9|d?d@}q9W|||<q W|S(sGenerate 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().
        I iiiii(trange(tpolyttableRtcrcR((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt_GenerateCRCTables

cCs%|d?d@|j|t|Ad@AS(s(Compute the CRC32 primitive on one byte.iii(tcrctabletord(RutchR((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt_crc32scCs=d|_d|_d|_x|D]}|j|q"WdS(NixV4igE#ixV4(tkey0tkey1tkey2t_UpdateKeys(Rutpwdtp((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRws
			
cCsx|j||j|_|j|jd@d@|_|jddd@|_|jt|jd?d@|j|_dS(NiIiii(RRRRnR(Rutc((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRscCsPt|}|jdB}|||dAd?d@A}t|}|j||S(sDecrypt a single character.iiii(RRRnR(RuRtk((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt__call__s

(	R	R
RRRRRwRR(((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRs					tstoretshrinktreducetimplodettokenizetdeflatet	deflate64tbzip2tlzmattersetlz77itwavpackiatppmdibt
ZipExtFilecBseZdZdd>ZdZejdZde	dZ
ddZddZd	Z
dd
ZdZdZd
ZRS(sZFile-like object for reading an archive member.
       Is returned by ZipFile.open().
    iiis*^(?P<chunk>[^\r\n]+)|(?P<newline>\n|\r\n?)cCsf||_||_||_|j|_|j|_|j|_|jtkrct	j
d|_n\|jtkrt
j|j}|rtd|j|fqtd|jfnd|_d|_d|_d|k|_d|_|jdk	r|jd8_n||_|j|_t|drY|j|_tdd	@|_n	d|_dS(
Niscompression type %d (%s)scompression type %dRitUiReI(t_fileobjt
_decryptert_close_fileobjR\t_compress_typeRft_compress_sizet_compress_leftRtzlibt
decompressobjt
_decompressorRtcompressor_namestgettNotImplementedErrort_unconsumedt_readbuffert_offsett
_universalRNtnewlinestmodeR&tnameR$Ret
_expected_crctcrc32t_running_crc(RutfileobjRtzipinfot	decryptert
close_fileobjtdescr((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRw,s4								icCs|jra|dkra|jjd|jd}|dkra|j|j|!}||_|Sn|js}tjj||Sd}x|dkst||kr|jd}|dkr|S|j	j
|}|jd}|dk	rJ|j
dkrg|_
n||j
kr-|j
j|n|jt|7_|dS|jd}|dkr|||t| }n|jt|7_||7}qW|S(	srRead and return a line from the stream.

        If limit is specified, at most limit bytes will be read.
        is
iRitnewlinetchunkN(RRRmRtiotBufferedIOBasetreadlineRtpeektPATTERNtsearchtgroupRNRR(RutlimitRtlinet	readaheadtmatchRR((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRTs8		!
cCs|t|j|jkr{|j|}t||jkrc||j|j|_d|_q{|jt|8_n|j|j|jd!S(s6Returns buffered bytes without advancing the position.ii(RRRR"(RutnR((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRscCstS(N(R(Ru((s,/opt/alt/python27/lib64/python2.7/zipfile.pytreadablescCsd}|dkrd}nxztr|dkrB|j|}n2|t|krp|j|t|}n|St|dkr|S||7}qWdS(sRead and return up to n bytes.
        If the argument is omitted, None, or negative, data is read and returned until EOF is reached..
        RiiN(RNRtread1R(RuRtbufR<((s,/opt/alt/python27/lib64/python2.7/zipfile.pyR"s		cCs^|jdkrdSt||jd@|_|rZ|j|jkrZtd|jndS(NIsBad CRC-32 for file %r(RRNRRRR(Rutnewdatateof((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt_update_crcs
cCsg|dks|dkr$|j}nt|j|j}|jdkrW||t|jkrW||t|j}t||j}t	||j}|j
j|}|jt|8_|r|jdk	rdj
t|j|}n|jtkrE|j|d|jdk|j|j||_d|_qW|j|7_nt|jdkr4||kr4|jtkr4|jj|jt|||j}|jj|_t|jdko|jdk}|r||jj7}n|j|d||j|j||_d|_n|j|j|j|!}|jt|7_|S(s7Read up to n bytes with at most one read() system call.iRRN(RNtMAX_NRRRRRRRt
MIN_READ_SIZEtminRR"RRtmapRRRRRt
decompresstunconsumed_tailtflush(RuRtlen_readbuffertnbytesR<R((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRs>(!	$cCs8z|jr|jjnWdtt|jXdS(N(RRtclosetsuperR(Ru((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRs	iN(R	R
RRRtretcompileRRNRRwRRRR"RRR(((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRs
'2
		
	4cBseZdZdZdeedZdZdZ	dZ
dZdZdZ
d	Zd
ZdZedZejd
ZddZdddZdddZddddZdZdZdddZddZdZdZRS(sd Class with methods to open, read, write, close, list zip files.

    z = ZipFile(file, mode="r", compression=ZIP_STORED, allowZip64=False)

    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" or append "a".
    compression: ZIP_STORED (no compression) or ZIP_DEFLATED (requires zlib).
    allowZip64: if True ZipFile will create files with ZIP64 extensions when
                needed, otherwise it will raise an exception when this would
                be necessary.

    trcCs\|dkrtdn|tkr*n*|tkrKtsTtdqTn	td||_t|_d|_i|_g|_	||_
|jdd	d|_}d|_d	|_t|trXd|_||_id
d6dd6dd6}yt||||_Wqtk
rT|dkrNd}}t||||_qUqXn'd
|_||_t|dd|_y|dkr|jn|dkrt|_no|dkry$|j|jj|jdWq"tk
r|jjddt|_q"XntdWn2|j}d|_|jsQ|jnnXdS(s>Open the ZIP file with mode read "r", write "w" or append "a".Rtwtas(ZipFile() requires mode "r", "w", or "a"s.Compression requires the (missing) zlib modules(That compression method is not supporteditbRR#twbsr+biRisMode must be "r", "w" or "a"N(RRR(RRRRt_allowZip64Rt
_didModifytdebugt
NameToInfotfilelisttcompressionRqRRNRt_commentRt
basestringt_filePassedR&R%R Rtgetattrt_RealGetContentsRR)t	start_dirRR(RutfileRRt
allowZip64tkeytmodeDictR ((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRwsf											


		


			
cCs|S(N((Ru((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt	__enter__FscCs|jdS(N(R(Ruttypetvaluet	traceback((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt__exit__IscCsk|j}yt|}Wntk
r8tdnX|sKtdn|jdkrb|GHn|t}|t}|t|_|t	||}|jdkr||}dG|G|G|GHn|||_
|j|j
d|j|}t
j|}d}x||kr"|jt}	t|	tkrEtdntjt|	}	|	ttkrvtdn|jdkr|	GHn|j|	t}
t|
}|j|	t|_|j|	t|_|	t|_|	dd!\|_|_|_ |_!|_"|_#}}
|_$|_%|_&|	d	d
!\|_'|_(|_)||_*|
d?d|
d
?d	@|
d@|d?|d
?d@|d@df|_+|j,|j||_|j-|_.|j/j0|||j1|j.<|t|	t|	t|	t}|jdkr	dG|GHq	q	W|j
}x8t2|j/dddt3D]}||_4|j}qKWdS(s/Read in the table of contents for the ZIP file.sFile is not a zip fileiisgiven, inferred, offsetisTruncated central directorys&Bad magic number for central directoryiiii	iiiii?ttotalRcSs|jS(N(Rd(tzinfo((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt<lambda>RtreverseN(5R RRRRR6R7t_ECD_COMMENTRR8RR)R"t	cStringIOtStringIOtsizeCentralDirRR*RtstructCentralDirt
_CD_SIGNATUREtstringCentralDirt_CD_FILENAME_LENGTHRt_CD_EXTRA_FIELD_LENGTHRt_CD_COMMENT_LENGTHRYt_CD_LOCAL_HEADER_OFFSETRdRCR]R^R_R`R\ReRfRgRaRbRcRhR[RRR&RRRtsortedRRi(RuR R;tsize_cdt	offset_cdtconcattinferredR<RtcentdirR&txtttdt
end_offsetR
((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRLsl	






I	&
"		
	cCs.g}x!|jD]}|j|jqW|S(s+Return a list of file names in the archive.(RRR&(RutlR<((s,/opt/alt/python27/lib64/python2.7/zipfile.pytnamelistscCs|jS(sJReturn a list of class ZipInfo instances for files in the
        archive.(R(Ru((s,/opt/alt/python27/lib64/python2.7/zipfile.pytinfolistscCsJdd	GHx:|jD]/}d|jd }d|j||jfGHqWdS(
s+Print a table of contents for the zip file.s%-46s %19s %12ss	File NamesModified    tSizes%d-%02d-%02d %02d:%02d:%02dis
%-46s %s %12dN(s	File NamesModified    R((RR[R&Rg(RuR
tdate((s,/opt/alt/python27/lib64/python2.7/zipfile.pytprintdirs	cCsnd}xa|jD]V}y8|j|jd}x|j|rFq4WWdQXWqtk
re|jSXqWdS(s%Read all the files and check the CRC.iiRNi(RR%R&R"R(Rut
chunk_sizeR
tf((s,/opt/alt/python27/lib64/python2.7/zipfile.pyttestzips
cCs5|jj|}|dkr1td|n|S(s,Return the instance of ZipInfo given 'name'.s(There is no item named %r in the archiveN(RRRNtKeyError(RuRtinfo((s,/opt/alt/python27/lib64/python2.7/zipfile.pytgetinfos
cCs
||_dS(s)Set default password for encrypted files.N(R(RuR((s,/opt/alt/python27/lib64/python2.7/zipfile.pytsetpasswordscCs|jS(s.The comment text associated with the ZIP file.(R(Ru((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRYscCsXt|tkrBddl}|jdtdd|t }n||_t|_dS(Nis3Archive comment is too long; truncating to %d bytest
stackleveli(RtZIP_MAX_COMMENTtwarningstwarnRRR(RuRYR4((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRYs	
	cCs|j|d|jS(s)Return file bytes (as a string) for name.R(R%R"(RuRR((s,/opt/alt/python27/lib64/python2.7/zipfile.pyR"scCs|dkrtdn|js-tdn|jrH|j}t}nt|jd}t}y!t|tr{|}n|j	|}|j
|jd|jt
}t|t
krtdntjt|}|ttkrtd	n|j|t}|tr/|j|tn||jkrWtd
|j|fn|jdk	r|j|j|jkrtd|jn|jd@}	d}
|	rg|s|j}n|std
|nt|}
|jd}t|
|dd!}|jd@r+|j d?d@}
n|j!d?d@}
t"|d|
krgtd|qgnt#||||
d|SWn|r|j$nnXdS(s#Return file-like object for 'name'.RRtrUs&open() requires mode "r", "U", or "rU"s3Attempt to read ZIP archive that was already closedR#isTruncated file headers Bad magic number for file headers3File name in directory "%s" and header "%s" differ.s*Overlapped entries: %s (possible zip bomb)is6File %s is encrypted, password required for extractioniiiiisBad password for fileRN(RRR6(%RR RRR%R&RRRR0R)RdR"tsizeFileHeaderRRR*RR|t
_FH_SIGNATURER}t_FH_FILENAME_LENGTHt_FH_EXTRA_FIELD_LENGTHRZRiRNRLRfR`RRRRhReRRR(RuRRRtzef_filetshould_closeR
tfheadertfnametis_encryptedtzdtbytestht
check_byte((s,/opt/alt/python27/lib64/python2.7/zipfile.pyR%sj						




cCsOt|ts!|j|}n|dkr<tj}n|j|||S(s#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(RRR0RNRotgetcwdt_extract_member(RutmembertpathR((s,/opt/alt/python27/lib64/python2.7/zipfile.pytextract)s
cCsC|dkr|j}nx!|D]}|j|||q"WdS(sExtract 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(RNR&RH(RuRGtmembersRR((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt
extractall7s
c
Cs|jjdtjj}tjjrH|jtjjtjj}ntjj|d}tjjjd|jtjjD}tjjdkr2d}t	|t
rd|D}ntj|dt
|}|j|}d|jtjjD}tjjjd	|D}ntjj||}tjj|}tjj|}|rtjj|rtj|n|jd
dkrtjj|stj|n|S|j|d|/}t|d}	tj||	Wd
QXWd
QX|S(sbExtract the ZipInfo object 'member' to a physical
           file on the path targetpath.
        Rkicss6|],}|dtjjtjjfkr|VqdS(RN(RoRGtcurdirtpardir(t.0R!((s,/opt/alt/python27/lib64/python2.7/zipfile.pys	<genexpr>Pss\s:<>|"?*cSs%i|]}tdt|qS(t_(R(RMR((s,/opt/alt/python27/lib64/python2.7/zipfile.pys
<dictcomp>Vs	RNcss|]}|jdVqdS(t.N(trstrip(RMR!((s,/opt/alt/python27/lib64/python2.7/zipfile.pys	<genexpr>[scss|]}|r|VqdS(N((RMR!((s,/opt/alt/python27/lib64/python2.7/zipfile.pys	<genexpr>\siRRN(R&RqRoRGRptaltsept
splitdriveRtsplitRRtstringt	maketransRt	translatetnormpathtdirnametexiststmakedirstisdirtmkdirR%Rtshutiltcopyfileobj(
RuRFt
targetpathRtarcnametillegalRt	upperdirstsourcettarget((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRECs4!."cCs+|j|jkr;ddl}|jd|jddn|jdkrVtdn|jsktd	n|jtkrt	rtd
n|jt
tfkrtdn|js'd}t
|jtkrd}n0|jtkrd
}n|jtkrd}n|r't|dq'ndS(s6Check for errors before writing a file to the archive.iNsDuplicate name: %rR2iRRs write() requires mode "w" or "a"s4Attempt to write ZIP archive that was already closeds.Compression requires the (missing) zlib modules(That compression method is not supportedsFiles counttFilesizesZipfile sizes would require ZIP64 extensions(RR(R&RR4R5RRR R\RRRRRNRRtZIP_FILECOUNT_LIMITRgRxRdR(RuR
R4trequires_zip64((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt_writecheckqs2								cCs|jstdntj|}tj|j}tj|j}|dd!}|d	krm|}ntj
jtj
j|d}x*|dtj
tjfkr|d}qW|r|d7}nt||}|dd@d>|_|rt|_n$|d	kr |j|_n	||_|j|_d|_|jj|_|j|t|_|rd|_d|_d|_|jdO_|jj|||j |j!<|jj"|j#t$d	St%|d

}	d|_}
d|_}|j&o|jdt'k}|jj"|j#||jt(krat)j*t)j+t)j,d}
nd	}
d}xx|	j-d}|sPn|t.|}t/||
d@}
|
r|
j0|}|t.|}n|jj"|qpWWd	QX|
r,|
j1}|t.|}|jj"|||_n	||_|
|_||_|r|j&r|t'krrtdn|t'krtdqn|jj}|jj2|jd|jj"|j#||jj2|d|jj|||j |j!<d	S(sLPut the bytes from filename into the archive under the name
        arcname.s7Attempt to write to ZIP archive that was already closediiiRkiliNR#g?iiiIs*File size has increased during compressings-Compressed size larger than uncompressed sizei (3R RRotstattS_ISDIRtst_modettimet	localtimetst_mtimeRNRGRWRRRpRQRRcRR\Rtst_sizeRgR`RLRdRhRRRfReRRRR&twriteRRR%RRxRRtcompressobjtZ_DEFAULT_COMPRESSIONtDEFLATEDR"RRtcompressRR)(RuR&R`R\tstR[tmtimeR[R
R ReRfR~tcmprRgRtposition((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRps	
	"
		
				

				cCsEt|ts}td|dtjtjd }|j|_|jddkrqd|_|jdO_qd|_n|}|jst	d	n|dk	r||_nt||_|jj
|_|j|t|_t|d
@|_|jtkrRtjtjtjd}|j||j}t||_n|j|_|jtkpy|jtk}|r|jrtdn|jj|j ||jj||j!d
@r|rdnd}|jjt"j#|t$|j|j|jn|jj|j%j&|||j'|j<dS(sWrite a file into the archive.  The contents is the string
        'bytes'.  'zinfo_or_arcname' is either a ZipInfo instance or
        the name of the file in the archive.R&R[iiRkiAiis7Attempt to write to ZIP archive that was already closedIis'Filesize would require ZIP64 extensionsis<LLQQs<LLLLNiAi((RRRlRmRR\R&RcR RRNRRgRLRdRhRRRReRRRqRrRsRtRRfRxRRRpRR`R*Ryt
_DD_SIGNATURERRR(Rutzinfo_or_arcnameRAR\R
tcoR~R((s,/opt/alt/python27/lib64/python2.7/zipfile.pytwritestrsL		
	

cCs|jdS(s2Call the "close()" method in case the user forgot.N(R(Ru((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt__del__scCs|jdkrdSz|jdkr|jr|jj}x|jD]}|j}|ddd>|dd>B|d	B}|d
d>|dd>B|dd	B}g}|jtks|j	tkr|j
|j|j
|j	d
}d
}n|j}|j	}|jtkr/|j
|jd}	n	|j}	|j}
|rt
|
d}
tjddt|ddt|||
}
td|j}td|j}n|j}|j}y|j\}
}tjtt||j||j||j|||j||t|
t|
t|jd|j|j|	}Wntk
rtj tt||j||j|j!|j|||j||t|j"t|
t|jd|j|j|	fIJnX|jj#||jj#|
|jj#|
|jj#|jqGW|jj}t|j}||}|}d}|t$kred}n*|tkrzd}n|tkrd}n|rM|j%st&|dntjt't(t)ddddd||||}|jj#|tjt*t+d|d}|jj#|t,|d}t,|d
}t,|d
}ntjt-t.dd||||t|j/	}|jj#||jj#|j/|jj0nWd|j}d|_|j1s|j2nXdS(sJClose the file, and for mode "w" and "a" write the ending
        records.NRRiii	iiiiiiIls<HHtQii-sFiles countsCentral directory offsetsCentral directory sizes would require ZIP64 extensionsii(RR(i(3R RNRRRLRR[RgRxRfRRdRRR*RyRRRR^RCR{RRR]R_R\ReRYRbRctDeprecationWarningRststderrR`R&RpRfRRR0R/R-R+R,RRPRORRRR(Rutpos1R
RRRRRgRfRdt
extra_dataR^RCR&R`R tpos2tcentDirCounttcentDirSizet
centDirOffsetRgtzip64endrectzip64locrecR;R ((s,/opt/alt/python27/lib64/python2.7/zipfile.pyR s	&&									


!	
				
			N(R	R
RRNR RRRwRRRR&R'R*R-R0R1tpropertyRYtsetterR"R%RHRJRERhRpR|R}R(((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRs0
G			I				
			S	.	\3	cBs#eZdZddZdZRS(sDClass to create ZIP archives with Python library files and packages.Rc
Cstjj|\}}tjj|r|tjj|d}tjj|r|rjd||f}n|}|jrdG|GdG|GHn|j|dd!|\}}|jrdG|GHn|j||tj	|}|j
dx|D]}	tjj||	}
tjj|	\}}tjj|
rptjjtjj|
dr|j|
|qq|dkr|j|
dd!|\}}|jrdG|GHn|j||qqWq|jrd	G|GHnxtj	|D]}	tjj||	}
tjj|	\}}|dkr|j|
dd!|\}}|jrbdG|GHn|j||qqWn`|ddkrt
d
n|j|dd!|\}}|jrdG|GHn|j||dS(
s,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.pyo or module.pyc.
        This method will compile the module.py into module.pyc if
        necessary.
        s__init__.pys%s/%ssAdding package intasiitAddings.pysAdding files from directorys.Files added with writepy() must end with ".py"sAdding fileN(RoRGRSR[RtisfileRt
_get_codenameRptlistdirtremovetsplitexttwritepyR(
RutpathnametbasenametdirRtinitnameR>R`tdirlistR&RGtroottext((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRsZ		

!					c
Cs8|d}|d}|d}tjj|r]tj|jtj|jkr]|}ntjj|stj|jtj|jkrddl}|jrdG|GHny|j||dt	Wn|j
k
r}|jGHnX|}n|}tjj|d}	|r.d||	f}	n||	fS(	sReturn (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).
        s.pys.pycs.pyoiNt	Compilingis%s/%s(
RoRGRRiRnt
py_compileRRRNRtPyCompileErrortmsgRS(
RuRRtfile_pytfile_pyctfile_pyoR>Rterrtarchivename((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRs*


$	$		(R	R
RRR(((s,/opt/alt/python27/lib64/python2.7/zipfile.pyRsAc	sddl}|jd}|dkr7tjd}n|sN|ddkrc|GHtjdn|ddkrt|d	kr|GHtjdnt|dd
}|jWdQXn|ddkrAt|d	kr|GHtjdnt|dd
}|j	}WdQX|r9dj
|GHndGHnT|ddkrt|d
krx|GHtjdnt|dd
}|j|d	WdQXn|ddkrt|d
kr|GHtjdnfdt|dddt}x|d	D]s}t
jj|}|sTt
jjt
jj|}n|dt
jt
jfkrxd}n|||qWWdQXndS(NisE        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
        iis-ls-cs-es-tiRs.The following enclosed file is corrupted: {!r}sDone testingicstjj|r(|j||tnvtjj|r|rS|j||nxHtj|D]4}|tjj||tjj||qcWndS(N(RoRGRRpRR[RR(tzfRGtzippathtnm(taddToZip(s,/opt/alt/python27/lib64/python2.7/zipfile.pyR"sRRR(s-ls-cs-es-t(ttextwraptdedentRNRstargvtexitRRR*R-tformatRJRRoRGRRXRKRL(targsRtUSAGERtbadfileRGR((Rs,/opt/alt/python27/lib64/python2.7/zipfile.pytmainsT	!	t__main__(oRR*RoRlRsR]tbinasciiRRiRRRTRRtImportErrorRNt__all__t	ExceptionRRRRxRfR3RRRPRORzRMR1R2R3R4R5R6R7RTRR8RRRRt_CD_CREATE_VERSIONt_CD_CREATE_SYSTEMt_CD_EXTRACT_VERSIONt_CD_EXTRACT_SYSTEMt
_CD_FLAG_BITSt_CD_COMPRESS_TYPEt_CD_TIMEt_CD_DATEt_CD_CRCt_CD_COMPRESSED_SIZEt_CD_UNCOMPRESSED_SIZERRRt_CD_DISK_NUMBER_STARTt_CD_INTERNAL_FILE_ATTRIBUTESt_CD_EXTERNAL_FILE_ATTRIBUTESRR|R}R7R8t_FH_EXTRACT_VERSIONt_FH_EXTRACT_SYSTEMt_FH_GENERAL_PURPOSE_FLAG_BITSt_FH_COMPRESSION_METHODt_FH_LAST_MOD_TIMEt_FH_LAST_MOD_DATEt_FH_CRCt_FH_COMPRESSED_SIZEt_FH_UNCOMPRESSED_SIZER9R:R+R,R(R0R/R-t_CD64_SIGNATUREt_CD64_DIRECTORY_RECSIZEt_CD64_CREATE_VERSIONt_CD64_EXTRACT_VERSIONt_CD64_DISK_NUMBERt_CD64_DISK_NUMBER_STARTt_CD64_NUMBER_ENTRIES_THIS_DISKt_CD64_NUMBER_ENTRIES_TOTALt_CD64_DIRECTORY_SIZEt_CD64_OFFSET_START_CENTDIRRytStructR
RR!RRKRtobjectRRRRRRRRR	(((s,/opt/alt/python27/lib64/python2.7/zipfile.pyt<module>s<$


				<	<<
cB