MINI SHELL

Server : Apache/2.2.2 (Fedora)
System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686
User : apache ( 48)
PHP Version : 5.2.9
Disable Function : NONE
Directory :  /proc/self/root/usr/lib/python2.4/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/lib/python2.4/tarfile.pyc
m
=Ec
@sdZdZdZdZdZdZdZdkZdkZdk	Z	dk
Z
dkZdkZdk
Z
eidjo
ed	nydkZdkZWnej
oeZZnXd
ddd
gZdZdZedZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'd Z(eeee e#e$e%e!e"e&e'e(fZ)eee%e(fZ*d!Z+d"Z,d#Z-d$Z.d%Z/d&Z0d'Z1d(Z2dZ3d)Z4d*Z5d+Z6d,Z7d-Z8d.Z9d/Z:d0Z;d1Z<d2Z=d3Z>ed4Z?e+d5fe,d6fe-d7fe.d8fe/d9fe0d:ffe4d;ffe5d<ffe6e1Bd=fe1d fe6d>ffe7d;ffe8d<ffe9e2Bd=fe2d fe9d>ffe:d;ffe;d<ffe<e3Bd?fe3d@fe<d>fff
Z@dAZAeiBdBjo
dCZCn
eiDiCZCd
eEfdDYZFdEeFfdFYZGdGeFfdHYZHdIeFfdJYZIdKeFfdLYZJdMfdNYZKdOfdPYZLdQeMfdRYZNdeMfdSYZOd
eMfdTYZPdUfdVYZQdWfdXYZRdYeRfdZYZSd[eRfd\YZTd]eUfd^YZVd_ZWd.ZXd`fdaYZYdbZZePi[Z[dS(cs,Read from and write to tar format archives.
s$Revision: 41341 $s0.6.4s!Lars Gustbel (lars@gustaebel.de)s5$Date: 2005-10-28 16:00:51 +1000 (Fri, 28 Oct 2005) $s9$Id: tarfile.py 41341 2005-10-28 06:00:51Z neal.norwitz $s3Gustavo Niemeyer, Niels Gustbel, Richard Townsend.Ntmacs'tarfile does not work for platform==mactTarFiletTarInfot
is_tarfiletTarErrortiitustart00idilt0t1t2t3t4t5t6t7tLtKtSiii`i@i iiiiii@i iiiiicCs
|itS(s@Convert a null-terminated string buffer to a python string.
    N(tstrstriptNUL(R((t/usr/lib/python2.4/tarfile.pytntsscCsTd}x"|d D]}|t|7}qWx"|dD]}|t|7}q6W|S(sCalculate the checksum for a member's header. It's a simple addition
       of all bytes, treating the chksum field as if filled with spaces.
       buf is a 512 byte long string buffer which holds the header.
    iiiN(tchktbuftctord(RRR((Rtcalc_chksumscCs|djodSn|djoti||dSndd}t||\}}xPt
|D]B}|i|}t||jo
tdn|i|qfW|djo@|i|}t||jo
tdn|i|ndS(sjCopy length bytes from fileobj src to fileobj dst.
       If length is None, copy the entire content.
    iNiisend of file reached(tlengthtNonetshutiltcopyfileobjtsrctdsttBUFSIZEtdivmodtblockst	remaindertxrangetbtreadRtlentIOErrortwrite(R!R"RR#R%RR(R&((RR s(






tlt-R(tdRtptrtwRtxtttTcCskg}xUtD]M}xD|D]/\}}||@|jo|i|PqqW|idq
Wdi|S(scConvert a file's mode to a string of the form
       -rwxrwxrwx.
       Used by TarFile.list()
    R.tN(tpermtfilemode_tablettabletbittchartmodetappendtjoin(R<R7R;R9R:((Rtfilemodes
	t/cCstii|itidS(NR@(tostpathtnormpathtreplacetsep(RB((Rt<lambda>scBstZdZRS(sBase exception.(t__name__t
__module__t__doc__(((RRstExtractErrorcBstZdZRS(s%General exception for extract errors.(RGRHRI(((RRJst	ReadErrorcBstZdZRS(s%Exception for unreadble tar archives.(RGRHRI(((RRKstCompressionErrorcBstZdZRS(s.Exception for unavailable compression methods.(RGRHRI(((RRLstStreamErrorcBstZdZRS(s=Exception for unsupported operations on stream-like TarFiles.(RGRHRI(((RRMst
_LowLevelFilecBs2tZdZdZdZdZdZRS(sLow-level file object. Supports reading and writing.
       It is used instead of a regular file object for streaming
       access.
    cCsjhdti<dtitiBtiB<|}ttdo|tiO}nti|||_dS(NR1R2tO_BINARY(RAtO_RDONLYtO_WRONLYtO_CREATtO_TRUNCR<thasattrROtopentnametselftfd(RWRVR<((Rt__init__s0cCsti|idS(N(RAtcloseRWRX(RW((RRZscCsti|i|S(N(RAR)RWRXtsize(RWR[((RR)scCsti|i|dS(N(RAR,RWRXR(RWR((RR,s(RGRHRIRYRZR)R,(((RRNs
				t_StreamcBstZdZdZdZdZdZdZdZdZ	dZ
d	d
ZedZ
dZd
ZRS(sClass that serves as an adapter between TarFile and
       a stream-like object.  The stream-like object only
       needs to have a read() or write() method and is accessed
       blockwise.  Use of gzip or bzip2 compression is possible.
       A stream-like object could be for example: sys.stdin,
       sys.stdout, a socket, a tape device etc.

       _Stream is intended to be used only internally.
    cCswt|_|djot||}t|_n|pd|_||_||_	||_||_
d|_d|_t|_
|djopy
dk}Wntj
otdnX||_|id|_|djo|iq|in|djohy
dk}Wntj
otdnX|djod|_|i|_qs|i|_ndS(	s$Construct a _Stream object.
        R6ltgzNszlib module is not availableR1tbz2sbz2 module is not available(tTrueRWt_extfileobjtfileobjRRNRVR<tFalsettypetbufsizeRtpostclosedtzlibtImportErrorRLtcrc32tcrct
_init_read_gzt_init_write_gzR^tdbuftBZ2Decompressortcmpt
BZ2Compressor(RWRVR<RcRaRdRgR^((RRYs@	

							

	



	cCs|ip|indS(N(RWRfRZ(RW((Rt__del__=s
cCs|iid|ii|ii|iid|_tidt	t
i
}|id||i
ido|i
d |_
n|i|i
tdS(s6Initialize for writing with gzip compression.
        i	is<Ls%ss.gziN(RWRgtcompressobjtDEFLATEDt	MAX_WBITSt
DEF_MEM_LEVELRotstructtpacktlongttimet	timestampt_Stream__writeRVtendswithR(RWRz((RRlAs
	cCs{|idjo|ii||i|_n|it|7_|idjo|ii	|}n|i
|dS(s&Write string s to the stream.
        R]ttarN(RWRcRgRiRRjReR*RotcompressR{(RWR((RR,NscCsa|i|7_xKt|i|ijo1|ii|i|i |i|i|_qWdS(s]Write string s to the stream if a whole new block
           is ready to be written.
        N(RWRRR*RdRaR,(RWR((Rt__writeXscCs|iodSn|idjo,|idjo|i|ii7_n|idjo|iov|ii|id|_|idjoF|iit	i
d|i|iit	i
d|id@qn|i
p|iint|_dS(	s[Close the _Stream object. No operation should be
           done on it afterwards.
        NR2R}R6R]s<ls<Ll(RWRfR<RcRRotflushRaR,RvRwRjReR`RZR_(RW((RRZas
 	+
cCs|ii|ii|_d|_|iddjo
tdn|iddjo
tdnt	|id}|id|d	@o=t	|idd
t	|id}|i|n|d@o<x9t
o-|id}|p
|tjoPqqWn|d@o<x9t
o-|id}|p
|tjoPq*q*Wn|d@o|idnd
S(s:Initialize for reading a gzip compressed fileobj.
        R6issnot a gzip fileissunsupported compression methodiiiiiN(RWRgt
decompressobjRtRoRmt
_Stream__readRKRLRtflagtxlenR)R_RR(RWRRR((RRkvs4	


,cCs|iS(s3Return the stream's file pointer position.
        N(RWRe(RW((RttellsicCs{||idjoWt||i|i\}}x$t|D]}|i|iq@W|i|n
t	d|iS(sXSet the stream's file pointer to pos. Negative seeking
           is forbidden.
        is seeking backwards is not allowedN(
ReRWR$RdR%R&R'tiR)RM(RWReR%RR&((Rtseeks
	cCs|djoSg}x7to/|i|i}|pPn|i|qWdi	|}n|i|}|i
t|7_
|S(sReturn the next size number of bytes from the stream.
           If size is not defined, return all bytes of the stream
           up to EOF.
        R6N(R[RR4R_RWt_readRdRR=R>ReR*(RWR[R4R((RR)s
cCs|idjo|i|Snt|i}|ig}x_||joQ|i|i}|pPn|i
i|}|i||t|7}q?Wdi
|}|||_|| S(s+Return size bytes from the stream.
        R}R6N(RWRcRR[R*RmRR4RdRRot
decompressR=R>(RWR[RR4R((RRs 


cCst|i}|ig}xP||joB|ii|i}|pPn|i	||t|7}qWdi
|}|||_|| S(ssReturn size bytes from stream. If internal buffer is empty,
           read another block from the stream.
        R6N(R*RWRRR4R[RaR)RdR=R>(RWR[RR4R((Rt__reads


(RGRHRIRYRqRlR,R{RZRkRRRR)RR(((RR\
s		(		
	
					
	tExFileObjectcBsttZdZdZdZddZdZedZedZ	dZ
d	Zd
dZdZ
RS(
sFile-like object for reading an archive member.
       Is returned by TarFile.extractfile(). Support for
       sparse files included.
    cCs|i|_|i|_d|_t|_|i|_	|i
|_
d|_d|_|i
o|i|_|i|_n
|i|_dS(NR1lR6(ttarfileRaRWttarinfoRVR<RbRftoffset_datatoffsetR[Ret
linebuffertissparsetsparset_readsparseR)t_readnormal(RWRR((RRYs				
cCs|ii|S(s"Overloadable read method.
        N(RWRaR)R[(RWR[((RRsicCsI|djo
ti}n|iid}|djot||}n|t|i8}xt|djof|djoY|i	t|d}|pPn|i|7_|t|8}|iid}qbW|djo|i}d|_|Sn|i| }|i|d|_x |ddjo|d }q!W|dS(	sRead a line with approx. size. If size is negative,
           read a whole line. readline() and read() must not
           be mixed up (!).
        is
idiR6is
N(R[tsystmaxintRWRtfindtnltminR*R)RR(RWR[RRR((Rtreadlines2



		
cCs>g}x1to)|i}|pPn|i|q	W|S(s2Return a list with all (following) lines.
        N(tresultR_RWRtlineR=(RWRR((Rt	readlinesscCs|io
tdn|ii|i|i|i|i}|djo
|}nt||}|i|7_|i|S(s*Read operation for regular files.
        sfile is closedN(
RWRft
ValueErrorRaRRReR[t	bytesleftRtbytestoreadRt_ExFileObject__read(RWR[RR((RR"s



cCs|io
tdn|djo|i|i}ng}xJ|djo<|i|}|pPn|t	|8}|i
|qAWdi|S(s)Read operation for sparse files.
        sfile is closediR6N(RWRfRR[RRetdatat_readsparsesectionRR*R=R>(RWR[RR((RR0s



cCs|ii|i}|djodSnt||i|i|i}t
|toN|i|i|i}|i|7_|i
i|i||i|Sn|i|7_t|SdS(s0Read a single section of a sparse file.
        R6N(RWRRRetsectionRRR[Rttoreadt
isinstancet_datatrealposRaRRR(RWR[RRR((RRBs
 cCs|iS(s*Return the current file position.
        N(RWRe(RW((RRTsicCsd|_|djo"tt|d|i|_n|djoJ|djot|i|d|_qt|i||i|_n|djo)tt|i||id|_ndS(s(Seek to a position in the file.
        R6iiiN(RWRtwhenceRtmaxReR[(RWReR((RRYs	
"

 
cCs
t|_dS(sClose the file object.
        N(R_RWRf(RW((RRZgs(RGRHRIRYRRRRRRRRRRZ(((RRs			
		cBstZdZddZdZdZeeZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZRS(sInformational class which holds the details about an
       archive member given by a tar header block.
       TarInfo objects are returned by TarFile.getmember(),
       TarFile.getmembers() and TarFile.gettarinfo() and are
       usually created internally.
    R6cCs||_d|_d|_d|_d|_d|_d|_t|_	d|_
d|_d|_d|_
d|_d|_d|_d|_dS(sXConstruct a TarInfo object. name is the optional name
           of the member.
        iiR6tusertgroupN(RVRWR<tuidtgidR[tmtimetchksumtREGTYPERctlinknametunametgnametdevmajortdevminortprefixRR(RWRV((RRYxs"															cCs d|ii|it|fS(Ns<%s %r at %#x>(RWt	__class__RGRVtid(RW((Rt__repr__scCsi|}t|dd!|_t|dd!d|_t|dd!d|_t|dd!d|_|dt	djot
|dd!d|_nMd	|_x@td
D]2}|idK_|it|d|7_qWt
|dd!d|_t|dd
!d|_|d
d!|_t|dd!|_t|dd!|_t|dd!|_y6t|dd!d|_t|dd!d|_Wn#tj
od|_|_nX|dd!|_|io |iido
t|_n|itjo.ttii t|i|i|_n|i!o|id7_n|S(sBConstruct a TarInfo object from a 512 byte string buffer.
        iidiliiti|iilii}iiiii	i)iIiQiYiR@N("tclsRRRRVtintR<RRtchrRxR[trangeRRRRRcRRRRRRRtisregR|tDIRTYPEtGNUTYPE_SPARSERCRARBR>tisdir(RRRR((Rtfrombufs@		
! 
.
c
Cs|itjod|i}	nU|i}d}	x2tdD]$}t|d@|	}	|dL}q=Wtd|	}	g}x|idfd|i	d	@dfd|i
dfd|idf|	d
fd|id
fd|i
df|idftd
ftdf|idf|idfd|idfd|idf|idffD]5\}}t|}|i|| ||tqLWdi|}t|}|d d||d}|t t|t7}||_|S(s8Return a tar header block as a 512 byte string.
        s%011oR6iiiiids%07oiis        iiii iis%06oN(s        i(!RWR[tMAXSIZE_MEMBERRRRRtpartsRVR<RRRRcRtMAGICtVERSIONRRRRRtvaluet	fieldsizeR*R-R=RR>RRRt	BLOCKSIZE(
RWRRRR-RRRRR[((Rttobufs*	
!	cCs
|itjS(N(RWRct
REGULAR_TYPES(RW((RRscCs
|iS(N(RWR(RW((RtisfilescCs
|itjS(N(RWRcR(RW((RRscCs
|itjS(N(RWRctSYMTYPE(RW((RtissymscCs
|itjS(N(RWRctLNKTYPE(RW((RtislnkscCs
|itjS(N(RWRctCHRTYPE(RW((RtischrscCs
|itjS(N(RWRctBLKTYPE(RW((RtisblkscCs
|itjS(N(RWRctFIFOTYPE(RW((RtisfifoscCs
|itjS(N(RWRcR(RW((RRscCs|itttfjS(N(RWRcRRR(RW((Rtisdevs(RGRHRIRYRRtclassmethodRRRRRRRRRRR(((RRps 		0	/									cBs.tZdZdZeZeZdZeZe	Z
ededZededddZ
ee
Z
dedZeeZdedd	ZeeZdedd
ZeeZhdd<d
d<dd<ZdZdZdZdZeeedZedZeedZedZddZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*he+e)<e,e)<e-e*<Z.d)Z/ed*Z0d+Z1ed,Z2d-Z3d.Z4d/Z5RS(0s=The TarFile Class provides an interface to tar archives.
    iR1cCs||_t|djp
|djo
tdn||_hdd<dd<dd	<||_|p"t|i|i}t|_	nZ|idjo t|d
o|i|_nt|do|i|_nt|_	||_t|_
g|_t|_d|_h|_|idjod|_|i|_n|idjoyd|_xmtoay|i}Wn$tj
o|iid
PnX|djo|iitdPqgqgWn|idjo
t|_ndS(sOpen an (uncompressed) tar archive `name'. `mode' is either 'r' to
           read from an existing archive, 'a' to append data to an existing
           file or 'w' to create a new file overwriting an existing one. `mode'
           defaults to 'r'.
           If `fileobj' is given, it is used for reading or writing data. If it
           can be determined, `mode' is overridden by `fileobj's mode.
           `fileobj' is not closed, when TarFile is closed.
        itrawsmode must be 'r', 'a' or 'w'R1trbtasr+bR2twbRVR<litawN(RVRWR*R<Rt_modeRatfileRbR`RRTR_Rftmemberst_loadedRtinodestfirstmembertnextRRKRR(RWRVR<RaR((RRYsJ	 
	(
 									
iic		Cs|o|o
tdnd|jo}|idd\}}|pd}|pd}||ijot	||i|}ntd|||||Sn*d|jo|idd\}}|pd}|pd}|djo
td	n|||t|||||}t|_|Sn|djojxZ|iD]O}t	||i|}y||d|SWqLttfj
o
qLqLXqLWtd
n%|djo|i|||Sntdd
S(s
Open a tar archive for reading, writing or appending. Return
           an appropriate TarFile class.

           mode:
           'r'          open for reading with transparent compression
           'r:'         open for reading exclusively uncompressed
           'r:gz'       open for reading with gzip compression
           'r:bz2'      open for reading with bzip2 compression
           'a' or 'a:'  open for appending
           'w' or 'w:'  open for writing without compression
           'w:gz'       open for writing with gzip compression
           'w:bz2'      open for writing with bzip2 compression
           'r|'         open an uncompressed stream of tar blocks for reading
           'r|gz'       open a gzip compressed stream of tar blocks
           'r|bz2'      open a bzip2 compressed stream of tar blocks
           'w|'         open an uncompressed stream for writing
           'w|gz'       open a gzip compressed stream for writing
           'w|bz2'      open a bzip2 compressed stream for writing
        snothing to opent:iR1R}sunknown compression type %rt|trwsmode must be 'r' or 'w's%file could not be opened successfullyRsundiscernible modeN(RVRaRR<tsplitR?tcomptypeRt	OPEN_METHtgetattrtfuncRLR\RdR4RbR`RKttaropen(	RRVR<RaRdRRR?R4((RRUbsB









		



cCs=t|djp
|djo
tdn||||S(sCOpen uncompressed tar archive name for reading or writing.
        iRsmode must be 'r', 'a' or 'w'N(R*R<RRRVRa(RRVR<Ra((RRs 
i	c
CsZt|djp
|djo
tdnydk}	|	iWn"ttfj
otdnXti	i
|\}}ti	i|}|djo
d}n|djo
d	}n||}|djot||d
}n|djo
|}ny+|i|||	i||||}Wntj
otdnXt|_|S(
skOpen gzip compressed tar archive name for reading or writing.
           Appending is not allowed.
        iRsmode must be 'r' or 'w'Nsgzip module is not availables.tgzs.tars.gzR6R(R1snot a gzip file(R*R<RtgziptGzipFileRhtAttributeErrorRLRARBtsplitextRVtpretexttbasenamettarnameRaRRRRt
compresslevelR4R+RKRbR`(
RRVR<RaRRRR4RR((Rtgzopens4 
	







	c
Cs,t|djp
|djo
tdny
dk}	Wntj
otdnXtii|\}}tii|}|djo
d}n|djo
d	}n||}|dj	o
td
ny+|i|||	i||d|}Wntj
otdnXt|_|S(
slOpen bzip2 compressed tar archive name for reading or writing.
           Appending is not allowed.
        iRsmode must be 'r' or 'w'.Nsbz2 module is not availables.tbz2s.tars.bz2R6s$no support for external file objectsRsnot a bzip2 file(R*R<RR^RhRLRARBRRVRRRRRaRRRtBZ2FileRR4R+RKRbR`(
RRVR<RaRRRR4RR^((Rtbz2opens, 








+	R}RR]RR^RcCs|iodSn|idjop|iittd|itd7_t|it	\}}|djo|iitt	|qn|ip|ii
nt|_dS(slClose the TarFile. In write-mode, two finishing zero blocks are
           appended to the archive.
        NRii(RWRfRRaR,RRRR$t
RECORDSIZER%R&R`RZR_(RWR%R&((RRZs

 
cCs1|i|}|djotd|n|S(sReturn a TarInfo object for member `name'. If `name' can not be
           found in the archive, KeyError is raised. If a member occurs more
           than once in the archive, its last occurence is assumed to be the
           most up-to-date version.
        sfilename %r not foundN(RWt
_getmemberRVRRtKeyError(RWRVR((Rt	getmembers

cCs)|i|ip|in|iS(sReturn the members of the archive as a list of TarInfo objects. The
           list has the same order as the members in the archive.
        N(RWt_checkRt_loadR(RW((Rt
getmemberss


cCs(g}|iD]}||iq~S(sReturn the members of the archive as a list of their names. It has
           the same order as the list returned by getmembers().
        N(t_[1]RWRRRV(RWRR((Rtgetnames'scCs|id|dj	o
|i}n|djo
|}nt|}tii	|\}}x#|dd!djo|d}qeWt}
|djoAt
tdo|ioti|}qti|}nti|i}d}|i}	ti|	oz|i|if}|io7|idjo'||ijot}|i|}qAt}|do||i|<qAnti |	o)t!}|ddjo|d7}qAn|ti"|	o
t#}nbti$|	ot%}ti&|}n9ti'|	o
t(}nti)|	o
t*}ndS||
_|	|
_+|i,|
_-|i.|
_/ti|	o|i0|
_1n
d|
_1|i2|
_3||
_||
_t4o7yt4i5|
i-d|
_6Wqt7j
oqXnt8o7yt8i9|
i/d|
_:Wq.t7j
oq.Xn|t(t*fjoRt
td	o>t
td
o.ti;|i<|
_=ti>|i<|
_?qn|
S(sOCreate a TarInfo object for either the file `name' or the file
           object `fileobj' (using os.fstat on its file descriptor). You can
           modify some of the TarInfo's attributes before you add it using
           addfile(). If given, `arcname' specifies an alternative name for the
           file in the archive.
        RiiR@tlstatR6iltmajortminorN(@RWRRaRRVtarcnameRCRARBt
splitdrivetdrvRRRTtdereferenceRtstatreststattfstattfilenoRtst_modetstmdtS_ISREGtst_inotst_devtinodetst_nlinkRRRcRtS_ISDIRRtS_ISFIFORtS_ISLNKRtreadlinktS_ISCHRRtS_ISBLKRR<tst_uidRtst_gidRtst_sizeR[tst_mtimeRtpwdtgetpwuidRRtgrptgetgrgidRRtst_rdevRRR(RWRVRRaR	RRRRcRR((Rt
gettarinfo-s




	
	+


							 cCs|ix|D]}|ot|iGd|ip|i|ip|i	fG|i
p
|iodd|i|i
fGnd|iGdti|id Gn|iG|o<|iodG|iGn|iodG|iGqnHqWd	S(
sPrint a table of contents to sys.stdout. If `verbose' is False, only
           the names of the members are printed. If it is True, an `ls -l'-like
           output is produced.
        s%s/%ss%10ss%d,%ds%10ds%d-%02d-%02d %02d:%02d:%02dis->slink toN(RWRRtverboseR?R<RRRRRRRRR[Ryt	localtimeRRVRRR(RWR&R((Rtlists$

(

cCs|id|djo
|}n|idj	oDtii|tii|ijo|idd|dSn|djoc|oT|djo
d}nx:ti
dD]%}|i|tii
||qWndSn|id||i||}|djo|idd|dSn|io-t|d	}|i|||in|iod|i||oLxIti
|D]4}|itii
||tii
||qWqn|i|dS(
sQAdd the file `name' to the archive. `name' may be any type of file
           (directory, fifo, symbolic link, etc.). If given, `arcname'
           specifies an alternative name for the file in the archive.
           Directories are added recursively by default. This can be avoided by
           setting `recursive' to False.
        Ristarfile: Skipped %rNt.R6istarfile: Unsupported type %rR(RWRRRRVRARBtabspatht_dbgt	recursivetlistdirtftaddR>R%RRRtaddfileRZR(RWRVRR,R.R((RR/s>


8


'



:cCs|idt|i|_|io|id7_n|iot|i|_n|itjo+|i	o
t
dq|iddnt|it
joV|i	ot
dt
q|i|it|it
d |_|iddnt|itjo|i	o|itd }x'|o|d	djo|d	 }q:W|it|}|d	 }|pt|tjot
d
tn||_||_q|i|it|itd |_|iddn|ii|i|it7_|d
j	oxt||i|it|it\}}|djo&|iitt||d7}n|i|t7_n|ii |d
S(s]Add the TarInfo object `tarinfo' to the archive. If `fileobj' is
           given, tarinfo.size bytes are read from it and added to the archive.
           You can create TarInfo objects using gettarinfo().
           On Windows platforms, `fileobj' should always be opened with mode
           'rb' to avoid irritation about the file size.
        RR@sfile is too large (>= 8 GB)is)tarfile: Created GNU tar largefile headerslinkname is too long (>%d)is+tarfile: Created GNU tar extension LONGLINKisname is too long (>%d)s+tarfile: Created GNU tar extension LONGNAMEiN(!RWRRCRRVRRR[RtposixRR+R*tLENGTH_LINKt_create_gnulongtGNUTYPE_LONGLINKtLENGTH_NAMEt
LENGTH_PREFIXRtGNUTYPE_LONGNAMERaR,RRRRR R$R%R&RRR=(RWRRaRVRR%R&((RR0sT







	


R6cCsE|idt|to
|}n|i|}|ioti	i
||i|_ny&|i
|ti	i
||iWntj
ok}|idjoqA|idjo|idd|iqA|idd|i|ifnAtj
o4}|idjoqA|idd|nXdS(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 TarInfo object. You can
           specify a different directory using `path'.
        R1iistarfile: %sstarfile: %s %rN(RWRRtmemberRRRRRARBR>Rt_link_targett_extract_memberRVtEnvironmentErrortet
errorleveltfilenameRR+tstrerrorRJ(RWR8RBR<R((Rtextract%s&


&$cCs|idt|to
|}n|i|}|io|i||Sn|i	t
jo|i||Sn_|ip
|io@t|i
to
tdq|i|i|i|SndSdS(sExtract a member from the archive as a file object. `member' may be
           a filename or a TarInfo object. If `member' is a regular file, a
           file-like object is returned. If `member' is a link, a file-like
           object is constructed from the link's target. If `member' is none of
           the above, None is returned.
           The file-like object is read-only and provides the following
           methods: read(), readline(), readlines(), seek() and tell()
        R1s'cannot extract (sym)link as file objectN(RWRRR8RRRRt
fileobjectRctSUPPORTED_TYPESRRRaR\RMtextractfileRRR(RWR8R((RRCFs



cCsl|ddjo|d }ntii|}tii|}|otii|ot}||_	t
|_d|_|i|_|i|_|i|_|i|_|i|_y|i||i	WqqXn|ip
|io$|idd|i	|ifn|id|i	|io|i||n|io|i||n|io|i||n|ip
|i o|i!||nc|ip
|io|i"||n5|it#jo|i$||n|i|||i%|||ip$|i&|||i'||ndS(s\Extract the TarInfo object tarinfo to a physical
           file called targetpath.
        iR@iis%s -> %sN((t
targetpathRARBRCtdirnamet	upperdirstexistsRttiRVRRcR<RRRRRRRWR:RRR+RRtmakefileRtmakedirRtmakefifoRRtmakedevtmakelinkRBtmakeunknowntchowntchmodtutime(RWRRDRHRF((RR:msN				$



cCsGyti|Wn/tj
o#}|itijoqCnXdS(s,Make a directory called targetpath.
        N(RAtmkdirRDR;R<terrnotEEXIST(RWRRDR<((RRJscCsC|i|}t|d}t|||i|idS(s'Make a file called targetpath.
        RN(	RWRCRtsourceRRDttargetR RZ(RWRRDRVRU((RRIs

cCs+|i|||idd|idS(sYMake a file from a TarInfo object with an unknown type
           at targetpath.
        is9tarfile: Unknown file type %r, extracted as regular file.N(RWRIRRDR+Rc(RWRRD((RRNscCs.ttdoti|n
tddS(s'Make a fifo called targetpath.
        tmkfifosfifo not supported by systemN(RTRARWRDRJ(RWRRD((RRKscCsttdpttdo
tdn|i}|io|tiO}n|tiO}ti	||ti|i|i
dS(s<Make a character or block device called targetpath.
        tmknodRLs'special devices not supported by systemN(RTRARJRR<RRtS_IFBLKtS_IFCHRRXRDRLRR(RWRRDR<((RRLs"
	

cCs|i}y8|ioti||nti|i|Wnt	j
o|io4ti
iti
i|i
|}t|}ny|i|i||Wqttfj
oP}ti
i|}yti||Wqtj
o}tdqXqXnXdS(sMake a (symbolic) link called targetpath. If it cannot be created
          (platform limitation), we try to make a copy of the referenced file
          instead of a link.
        slink could not be createdN(RRtlinkpathRRAtsymlinkRDtlinkR9RRBR>RERVRCRWR:RR;RR<Rtcopy2R+(RWRRDR<R[((RRMs&	

	cCstottdootidjo\yti|id}WnOt	j
oCyti
|id}Wqt	j
oti}qXnXyti
|id}WnOt	j
oCyti|id}Wqt	j
oti}qXnXy_|io'ttdoti|||n(tidjoti|||nWqtj
o}tdqXndS(s6Set owner of targetpath according to tarinfo.
        tgeteuidiitlchowntos2emxscould not change ownerN(R RTRAR_R"tgetgrnamRRtgRR#RtgetgidtgetpwnamRtuR!RtgetuidRR`RDRtplatformROR;R<RJ(RWRRDR<RcRf((RROs.*cCsPttdo<yti||iWqLtj
o}tdqLXndS(sASet file permissions of targetpath according to tarinfo.
        RPscould not change modeN(	RTRARPRDRR<R;R<RJ(RWRRDR<((RRPscCsttdpdSntidjo|iodSny ti||i|ifWnt	j
o}tdnXdS(sBSet modification time of targetpath according to tarinfo.
        RQNtwin32s"could not change modification time(RTRARRhRRRQRDRR;R<RJ(RWRRDR<((RRQs cCs|id|id
j	o|i}d
|_|Sn|ii|ixto|ii	t
}|pd
Snyti
|}Wntj
o|ioY|itt
jo
d}nd}|idd|i|f|it
7_qMq"|idjo
tdnd
SnXPqMW|it|jo|idd	|in|i|_|it
7_|i|ijo|i|i||Sn|i|_|ip|itjo|i|i|i7_n|i i!||S(sReturn the next member of the archive as a TarInfo object, when
           TarFile is opened for reading. Return None if there is no more
           available.
        tratemptytinvalidis0x%X: %s blockis$empty, unreadable or compressed fileistarfile: Bad Checksum %rN("RWRRRtmRaRRR_R)RRRRRRtignore_zerostcountRtadjR+RKRRRVRct	TYPE_METHRRRBt_blockR[RR=(RWRmRRRp((RR(sJ
		


	cCsd}|i}xG|djo9|iit}||7}|i	t7_	|t8}qW|i
}|i	|_	|itjot
||_n$|itjot
||_n|S(sTEvaluate the blocks that hold a GNU longname
           or longlink member.
        R6iN(RRR[RoRWRaR)RtblockRRRcR7RRVR4R(RWRRoRRRs((Rtproc_gnulongws 	

cCs|i}t}d}d}d}xtdD]}	y<t
|||d!d}t
||d|d!d}Wnt
j
oPnX||jo|it|||n|it|||||7}||}|d7}q4Wt|d}
t
|dd	!d}x|
d
jo|iit}|it7_d}xtdD]}	y<t
|||d!d}t
||d|d!d}Wnt
j
oPnX||jo|it|||n|it|||||7}||}|d7}q]Wt|d
}
qW||jo|it|||n||_|i|_|i|i|i7_||_|ii||S(s8Analyze a GNU sparse header plus extra headers.
        iliiiiiiiiiiiN(RRRt_ringbuffertspRetlastposRR'RRRtnumbytesRR=t_holeRRt
isextendedtorigsizeRWRaR)RRRRrR[R(RWRR{RRxRwRvReRRRzR((Rtproc_sparses`	
"




"



		cCs2t|t\}}|o|d7}n|tS(s_Round up a byte count by BLOCKSIZE and return it,
           e.g. _block(834) => 1024.
        iN(R$RoRR%R&(RWRoR%R&((RRrs
cCs}|i}|djot|}n|i|}x>t|dddD]&}|||i
jo||SqOqOWdS(s}Find an archive member by name from bottom to top.
           If tarinfo is given, it is used as the starting point.
        iiN(RWRRRRR*tendtindexR'RRV(RWRVRR}RR((RRs
cCs:x*to"|i}|djoPqqWt|_dS(sWRead through the entire archive file and look for readable
           members.
        N(R_RWRRRR(RWR((RRs

cCsV|iotd|iin|dj	o$|i|jotd|indS(snCheck if TarFile is still open, and if the operation's mode
           corresponds to TarFile's mode.
        s%s is closedsbad operation for mode %rN(RWRfR+RRGR<RR(RWR<((RRs

cCs)|iot|iSnt|SdS(s$Provide an iterator object.
        N(RWRtiterRtTarIter(RW((Rt__iter__s
cCs|t7}t}d|_||_d|_t||_|i	i
|i|it
7_|i	i
|t|it
\}}|djo&|i	i
tt
||d7}n|i|t
7_dS(sWrite a GNU longname/longlink member to the TarFile.
           It consists of an extended tar header, with the length
           of the longname as size, followed by data blocks,
           which contain the longname as a null terminated string.
        s
././@LongLinkiiN(RVRRRRcR<R*R[RWRaR,RRRR$R%R&(RWRVRcR%RR&((RR3s
				
cCs%||ijoti|IJndS(s.Write debugging output to sys.stderr.
        N(tlevelRWtdebugRtstderrtmsg(RWRR((RR+!s(6RGRHRIRRbR
RnR=R1RRARRYRURRRRRRZRRRR%R_R(R/R0R@RCR:RJRIRNRKRLRMRORPRQRRtR|R7R4RRqRrRRRRR3R+(((RR
s`CA$!				
	d4C!	'	:													O		=!				
			RcBs)tZdZdZdZdZRS(sMIterator Class.

       for tarinfo in TarFile(...):
           suite...
    cCs||_d|_dS(s$Construct a TarIter object.
        iN(RRWR~(RWR((RRY/s	cCs|S(s Return iterator object.
        N(RW(RW((RR4scCs|iip0|ii}|pt|i_tqpn4y|ii|i}Wnt	j
o
tnX|id7_|S(sReturn the next item using TarFile's next() method.
           When all members have been read, set TarFile as _loaded.
        iN(
RWRRRRR_t
StopIterationRR~t
IndexError(RWR((RR8s
(RGRHRIRYRR(((RR(s		t_sectioncBs tZdZdZdZRS(s$Base class for _data and _hole.
    cCs||_||_dS(N(RRWR[(RWRR[((RRYPs	cCs(|i|jo|i|ijnS(N(RWRR[(RWR((Rt__contains__Ss(RGRHRIRYR(((RRMs	RcBstZdZdZRS(s/Represent a data section in a sparse file.
    cCs ti|||||_dS(N(RRYRWRR[R(RWRR[R((RRYYs(RGRHRIRY(((RRVsRycBstZdZRS(s/Represent a hole section in a sparse file.
    (RGRHRI(((RRy]sRucBs tZdZdZdZRS(sMRingbuffer class which increases performance
       over a regular list.
    cCs
d|_dS(Ni(RWtidx(RW((RRYfscCs|i}xgto_||}||joPn|d7}|t|jo
d}n||ijodSqqW||_|S(Nii(RWRR_titemRR*R(RWRRR((RRhs	




	(RGRHRIRYR(((RRubs	it
TarFileCompatcBsttZdZdedZdZdZdZdZdZ	dZ
eed	Zd
Z
dZRS(sRTarFile class compatible with standard module zipfile's
       ZipFile class.
    R1cCs|tjoti|||_n0|tjoti	|||_n
t
d|dd!djok|ii}xYt
t|D]A}||}|i|_|i|_ti|id |_qWndS(Nsunknown compression constantiiR1i(tcompressiont	TAR_PLAINRRRR<RWRtTAR_GZIPPEDRRRRR'R*RRmRVR>R[t	file_sizeRytgmtimeRt	date_time(RWRR<RRRmR((RRYs

	
cCstd|iS(NcCs|iS(N(RmRV(Rm((RRFs(tmapRWtinfolist(RW((RtnamelistscCstd|iiS(NcCs
|itjS(N(RmRcR(Rm((RRFs(tfilterRWRR(RW((RRs	cCs|iidS(N(RWRR((RW((RtprintdirscCsdS(N((RW((RttestzipscCs|ii|S(N(RWRRRV(RWRV((RtgetinfoscCs"|ii|ii|iS(N(RWRRCRRVR)(RWRV((RR)scCs|ii||dS(N(RWRR/R>R(RWR>Rt
compress_type((RR,scCs_dk}dk}|i|_|i|_|i|i|_	|ii||i|dS(N(tStringIOtcalendartzinfoR>RVRR[ttimegmRRRWRR0tbytes(RWRRRR((Rtwritestrs		cCs|iidS(N(RWRRZ(RW((RRZs(RGRHRIRRYRRRRRR)RR,RRZ(((RR|s							cCs<yt|}|itSWntj
otSnXdS(sfReturn True if name points to a tar archive that we
       are able to handle, else return False.
    N(RURVR4RZR_RRb(RVR4((RRs
(\RIt__version__tversiont
__author__t__date__t	__cvsid__t__credits__RRARRRSRyRvRhRhR"R Rt__all__RRRRRR5R2R6RRtAREGTYPERRRRRRtCONTTYPER7R4RRBRtS_IFLNKtS_IFREGRYtS_IFDIRRZtS_IFIFOtTSUIDtTSGIDtTSVTXtTUREADtTUWRITEtTUEXECtTGREADtTGWRITEtTGEXECtTOREADtTOWRITEtTOEXECRRR R8R?RERCRBt	ExceptionRRJRKRLRMRNR\tobjectRRRRRRRyR(RuRRRRRU(SRLRvRRRNRR\RRRRRZRRRRMRRRRRRR RRRYRRRR4RRRRRKR8RuRRARRRRRyRUR7RRRRSRRRRRR R2RRR?RRRRRJR6RRRRRRRRBR5RR"RRRCRRyR((Rt?s							

*			
"%	/	

Anon7 - 2021