python (3.12.0)

(root)/
lib/
python3.12/
__pycache__/
tarfile.cpython-312.pyc

ˑedZdZdZdZddlmZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlZddlZddlZ	ddlZ	ddlZeeefZgdZdZd	Zed
zZdZdZd
Zd
ZdZ dZ!dZ"dZ#dZ$dZ%dZ&dZ'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2e2Z3e!e"e#e$e'e(e)e%e&e*e+e,fZ4e!e"e)e,fZ5e*e+e,fZ6dZ7hd Z8e9e9e9e:e:e:d!Z;ejxd"k(rd#Z=nej|Z=d$Z?d%Z@d&ZAd'e3fd(ZBd)ZCdedfd*ZDd+ZEGd,d-eFZGGd.d/eGZHGd0d1eGZIGd2d3eGZJGd4d5eGZKGd6d7eGZLGd8d9eLZMGd:d;eLZNGd<d=eLZOGd>d?eLZPGd@dAeLZQGdBdCZRGdDdEZSGdFdGeTZUGdHdIeTZVGdJdKe	jZXGdLdMeGZYGdNdOeYZZGdPdQeYZ[GdRdSeYZ\GdTdUeYZ]GdVdWeYZ^dddXZ_dYZ`dZZad[Zbe`eaebd\ZceTZdGd]d^eTZeGd_d`eTZfdaZgefj
ZdbZheidck(rehyy#e$rdZYwxYw#e$rdZYwxYw)ez,Read from and write to tar format archives.
z0.9.0u"Lars Gustäbel (lars@gustaebel.de)u4Gustavo Niemeyer, Niels Gustäbel, Richard Townsend.)openN)TarFileTarInfo
is_tarfileTarError	ReadErrorCompressionErrorStreamErrorExtractErrorHeaderErrorENCODINGUSTAR_FORMAT
GNU_FORMAT
PAX_FORMATDEFAULT_FORMATrfully_trusted_filterdata_filter
tar_filterFilterErrorAbsoluteLinkErrorOutsideDestinationErrorSpecialFileErrorAbsolutePathErrorLinkOutsideDestinationErrorisustar  sustar00d01234567LKSxgX)pathlinkpathsizemtimeuidgidunamegname>r/r6r5r0)atimectimer2r3r4r1ntutf-8cv|td|j||}|d||t|z
tzzS)z8Convert a string to a null-terminated bytes object.
    Nzmetadata cannot contain None)
ValueErrorencodelenNUL)slengthencodingerrorss    ;/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/tarfile.pystnrEsC	y788	6"AWf:#a&C///c\|jd}|dk7r|d|}|j||S)z8Convert a null-terminated bytes object to a string.
    rN)finddecode)r@rBrCps    rDntsrLs4	
u
ABw
bqE88Hf%%rFc6|ddvrMd}tt|dz
D]}|dz}|||dzz
}|ddk(rdt|dz
z|z
}|S	t|dd}t|j	xsd	d}|S#t
$rt
d
wxYw)z/Convert a number field to a python number.
    r)r-rOasciistrict0invalid header)ranger>rLintstripr<InvalidHeaderError)r@nis   rDntir\s
	t~
s1vz"	A
!GA
1q5MA	
Q45=#a&1*%)*A
H	7Aw)AAGGI$a(A
H	7$%566	7s+BBrPc|}t|}d|cxkrd|dz
zkr nntd|dz
|fzdtz}|S|tk(rzd|dz
z|cxkrd|dz
zkrbntd	|dk\r
t	dg}nt	dg}d|z|z}t|dz
D]}|j
d|dz|dz}|Std	)
z/Convert a python number to a number field.
    rrPr-z%0*orRrQrNrOzoverflow in number field)rWbytesr?r	bytearrayrVinsertr<)rZdigitsformat
original_nr@r[s      rDitnrdsJAAA!fqj!!&FQJ?*G4s:
H
:	36A:#6"6!"Qcfqj>Q"Q344
65'"A5'"Av
!Avz"	A
HHQE	"
!GA	
H344rFcdttjd|z}dttjd|z}||fS)aCalculate the checksum for a member's header by summing up all
       characters except for the chksum field which is treated as if
       it was filled with spaces. According to the GNU tar sources,
       some tars (Sun and NeXT) calculate chksum with signed char,
       which will be different if there are chars in the buffer with
       the high bit set. So we calculate two checksums, unsigned and
       signed.
    rQ
148B8x356B
148b8x356b)sumstructunpack_from)bufunsigned_chksum
signed_chksums   rDcalc_chksumsrnsGC 2 2< EFFO#f00sCDDMM))rFcx|xsd}|dk(ry|tj|||yt||\}}t|D]:}|j	|}t||kr|d|j
|<|dk7r8|j	|}t||kr|d|j
|y)zjCopy length bytes from fileobj src to fileobj dst.
       If length is None, copy the entire content.
    i@rNunexpected end of data)shutilcopyfileobjdivmodrVreadr>write)	srcdstrA	exceptionbufsizeblocks	remainderbrks	         rDrrrrs"G
{
~3W-vw/FI
6]hhws8g455		#	A~hhy!s8i455		#
rFcttjdd}|!|j|dj	|}t|dy)NrBbackslashreplace )end)getattrsysstdoutr=rJprint)r@rBs  rD_safe_printrs@szz:t4H
HHX1299(C	!rFceZdZdZy)rzBase exception.N__name__
__module____qualname____doc__rFrDrrsrFrceZdZdZy)rz%General exception for extract errors.NrrrFrDrrs/rFrceZdZdZy)rz&Exception for unreadable tar archives.NrrrFrDrrs0rFrceZdZdZy)r	z.Exception for unavailable compression methods.NrrrFrDr	r	s8rFr	ceZdZdZy)r
z=Exception for unsupported operations on stream-like TarFiles.NrrrFrDr
r
sGrFr
ceZdZdZy)rz!Base exception for header errors.NrrrFrDrrs+rFrceZdZdZy)EmptyHeaderErrorzException for empty headers.NrrrFrDrr s&rFrceZdZdZy)TruncatedHeaderErrorz Exception for truncated headers.NrrrFrDrr#s*rFrceZdZdZy)EOFHeaderErrorz"Exception for end of file headers.NrrrFrDrr&s,rFrceZdZdZy)rYzException for invalid headers.NrrrFrDrYrY)s(rFrYceZdZdZy)SubsequentHeaderErrorz3Exception for missing and invalid extended headers.NrrrFrDrr,s=rFrc(eZdZdZdZdZdZdZy)
_LowLevelFilezLow-level file object. Supports reading and writing.
       It is used instead of a regular file object for streaming
       access.
    ctjtjtjztjzd|}ttdr|tjz}tj||d|_y)NrwO_BINARYi)	osO_RDONLYO_WRONLYO_CREATO_TRUNChasattrrrfd)selfnamemodes   rD__init__z_LowLevelFile.__init__9sarzz)BJJ6
2z"BKKD''$e,rFcBtj|jyN)rcloserrs rDrz_LowLevelFile.closeBs
rFcBtj|j|Sr)rrtrrr1s  rDrtz_LowLevelFile.readEswwtww%%rFcDtj|j|yr)rrurrr@s  rDruz_LowLevelFile.writeHs
!rFN)rrrrrrrtrurrFrDrr3s
-&rFrcZeZdZdZdZdZdZdZdZdZ	dZ
d	Zdd
ZdZ
dZd
Zy)_StreamaClass 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.
    cd|_|t||}d|_|dk(rt|}|j}|xsd|_||_||_||_||_d|_	d|_
d|_	|dk(r[	ddl}||_|jd|_|d
k(r"|j"|_|j'y|j)|y|dk(rI	ddl}|d
k(r(d|_|j/|_t2|_y|j5||_y|d
k(rN	ddl}	|d
k(r.d|_|	j9|_|	j:|_y|	j=|_y|dk7rtd|zy#t$r
td	dwxYw#t$r
tddwxYw#t$r
tddwxYw#|js|jj?d|_xYw)z$Construct a _Stream object.
        TNF*rFrgzzzlib module is not availablerbz2bz2 module is not availablexzlzma module is not availabletarunknown compression type %r) _extfileobjr_StreamProxygetcomptyperrcomptypefileobjryrkposclosedzlibImportErrorr	crc32crcerrorrx
_init_read_gz_init_write_gzrdbufBZ2DecompressorcmpOSError
BZ2CompressorlzmaLZMADecompressor	LZMAErrorLZMACompressorr)
rrrrrry
compresslevelrrrs
          rDrz_Stream.__init__Vs ?#D$/G$Ds?#7+G**,H
		 
-	4U!	::c?3;%)ZZDN&&(''
6U"T3; #DI"224DH%,DN"00?DHT!U3; #DI#446DH%)^^DN#224DHU"&'Dx'OPP#E#U*+IJPTTU#T*+HItST#U*+IJPTTU	##""$DKsy:GFAGGG F($,GG(G.G22G%G;GF%%G(F>>GGG0H
cXt|dr|js|jyyy)Nr)rrrrs rD__del__z_Stream.__del__s#4"4;;JJL,7"rFct|jj||jj|jj|jjd|_t
jdttj}|jd|zdz|jjdr|jdd|_tjj|j|_|j|jj!dd	t"zy)
z6Initialize for writing with gzip compression.
        r<Lss.gzNz
iso-8859-1replace)rcompressobjDEFLATED	MAX_WBITS
DEF_MEM_LEVELrripackrWtime_Stream__writerendswithrr/basenamer=r?)rr	timestamps   rDrz_Stream._init_write_gzs99(()-););*.))*=*=)=)-)@)@)*	,
KKc$))+&67	(94{BC99e$		#2DIGG$$TYY/	TYY%%lI>DErFc*|jdk(r+|jj||j|_|xjt|z
c_|jdk7r|jj|}|j|y)z&Write string s to the stream.
        rrN)	rrrrrr>rcompressrrs  rDruz
_Stream.writesg==D yyq$((3DHCF==E!!!!$AQrFcZ|xj|z
c_t|j|jkDrt|jj	|jd|j|j|jd|_t|j|jkDrsyy)z]Write string s to the stream if a whole new block
           is ready to be written.
        N)rkr>ryrrurs  rD__writez_Stream.__writesr	
A
$((mdll*LLtxx
67xx
.DH$((mdll*rFc|jryd|_	|jdk(r<|jdk7r-|xj|jjz
c_|jdk(r|jr|jj|jd|_|jdk(ru|jjtjd|j|jjtjd|jdz|js|jjyy#|js|jjwwxYw)	z[Close the _Stream object. No operation should be
           done on it afterwards.
        NTrrrFrrl)rrrrkrflushrrurirrrrrrs rDrz
_Stream.closes	;;	%yyCDMMU$:DHHNN,,yyCDHH""488,==D(LL&&v{{4'BCLL&&v{{4J9N'OP##""$$4##""$$sDE)E=c|jj|jj|_d|_|jddk7rt
d|jddk7rtdt|jd}|jd|d	zrIt|jdd
t|jdzz}|j||dzr	|jd}|r	|tk(rn|dzr	|jd}|r	|tk(rn|dzr|jdy
y
)z:Initialize for reading a gzip compressed fileobj.
        rFr.snot a gzip filer-zunsupported compression methodrQrPN)r
decompressobjrrr
_Stream__readrr	ordrtr?)rflagxlenr@s    rDrz_Stream._init_read_gzs+99**DII,?,?+?@	;;q>[(-..;;q>W$"#CDD4;;q>"A!8t{{1~&s4;;q>/B)BBDIIdO!8KKNAH"9KKNAH!8KKNrFc|jS)z3Return the stream's file pointer position.
        )rrs rDtellz_Stream.tells
xxrFc||jz
dk\rnt||jz
|j\}}t|D]}|j	|j|j	||jStd)zXSet the stream's file pointer to pos. Negative seeking
           is forbidden.
        rz seeking backwards is not allowed)rrsryrVrtr
)rrrzr{r[s     rDseekz_Stream.seeksy>Q &sTXX~t|| DFI6]
(		$,,'
(IIi xx@AArFcl|J|j|}|xjt|z
c_|S)z5Return the next size number of bytes from the stream.)_readrr>)rr1rks   rDrtz_Stream.reads0jjCH
rFc(|jdk(r|j|St|j}|jg}||kr|jr|j}d|_n(|j
j
|j}|snA	|jj|}|j||t|z
}||krdj|}||d|_|d|S#|j$r}td|d}~wwxYw)z+Return size bytes from the stream.
        rrFzinvalid compressed dataN)rrr>rrkrrtryr
decompressrxrappendjoin)rr1ctrkes      rDrz
_Stream._reads==E!;;t$$		N
YYK$hxxhhll''5
Bhh))#.
HHSM
SMA$h
HHQKdeH	$x
>>
B 9:A
BsC11DDDc*t|j}|jg}||krM|jj|j}|sn%|j||t|z
}||krMdj
|}||d|_|d|S)zsReturn size bytes from stream. If internal buffer is empty,
           read another block from the stream.
        rFN)r>rkrrtryrr)rr1rrrks     rD__readz_Stream.__read.s
M
XXJ$h,,##DLL1C
HHSM
SMA$h
HHQKTU8$xrFN)r)rrrrrrrrurrrrrrtrrrrFrDrrKsFENF"/%,>
6rFrc(eZdZdZdZdZdZdZy)rzsSmall proxy class that enables transparent compression
       detection for the Stream interface (mode 'r|*').
    cZ||_|jjt|_yr)rrt	BLOCKSIZErk)rrs  rDrz_StreamProxy.__init__Ds<<$$Y/rFcP|jj|_|jSr)rrtrkrs  rDrtz_StreamProxy.readHsLL%%	xxrFc|jjdry|jdddk(r|jdddk(ry	|jjd
ryy)
NsrrsBZhr
s1AY&SYr)s]s7zXZrr)rk
startswithrs rDrz_StreamProxy.getcomptypeLsV88/
XXa]f
$!B9)D
XX
 
 !C
DrFc8|jjyr)rrrs rDrz_StreamProxy.closeVsrFN)rrrrrrtrrrrFrDrr?s0rFrcheZdZdZd
dZdZdZdZdZdZ	e
jfd	Zd
d
Z
dZdZy)_FileInFilezA thin wrapper around an existing file object that
       provides a part of its data as an individual file
       object.
    Nc||_||_||_d|_||_d|_|d|fg}d|_g|_d}|j}|D]U\}}||kDr|jjd||df|jjd|||z|f||z
}||z}W||jkr*|jjd||jdfyy)NrFT)	roffsetr1positionrr	map_indexmapr)rrrr1r	blockinfolastposrealposs        rDrz_FileInFile.__init__cs	
	TI++%	$LFD >?HHOOT66D='BCtOGtmG	$TYYHHOOUGTYY=>rFcyrrrs rDrz_FileInFile.flush|srFcyNTrrs rDreadablez_FileInFile.readablesrFcyNFrrs rDwritablez_FileInFile.writablesrFc6|jjSr)rseekablers rDr%z_FileInFile.seekables||$$&&rFc|jS)z*Return the current file position.
        )rrs rDrz_FileInFile.tell}}rFc.|tjk(r1tt|d|j|_|j
S|tjk(rc|dkr*t|j
|zd|_|j
St|j
|z|j|_|j
S|tjk(r>tt|j|z|jd|_|j
Std)z(Seek to a position in the file.
        rzInvalid argument)	ioSEEK_SETminmaxr1rSEEK_CURSEEK_ENDr<)rrwhences   rDrz_FileInFile.seeksR[[ Ha 0$))<DM}}r{{
"!| #DMMH$<a @
}}!$DMMH$<dii H
}}	r{{
"DII$8$)) DaHDM}}/00rFc||j|jz
}n#t||j|jz
}d}|dkDr$	|j|j\}}}}||jcxkr|krnnn?|xjdz
c_|jt|jk(rd|_vt|||jz
}|re|jj||j|z
z|jj|}t||k7rtd||z
}n|t|zz
}||z}|xj|z
c_|dkDr$|S)z!Read data from the file.
        rFrr-rp)r1rr+rrr>rrrtrr?)	rr1rkdatastartstoprrAr|s	         rDrtz_FileInFile.readsD<99t}},DtTYY67DQh,0HHT^^,D)eT6DMM0D0NNa'N~~TXX6)*tdmm34F!!&DMME,A"BCLL%%f-q6V##$<==qsV|#FNDMMV#M'Qh(
rFch|jt|}||dt|t|Sr)rtr>)rr|rks   rDreadintoz_FileInFile.readintos,iiA)3s83xrFcd|_yr)rrs rDrz_FileInFile.closes	rFr)rrrrrrr r#r%rr)r*rrtr5rrrFrDrr]sB
?2
'
%'KK >
rFrceZdZfdZxZS)ExFileObjectct|j|j|j|j|j
}t||yr)rroffset_datar1rsparsesuperr)rtarfiletarinfor	__class__s    rDrzExFileObject.__init__s;goow/B/BgllGNN<
!rFrrrr
__classcell__r?s@rDr8r8s
""rFr8ceZdZy)rN)rrrrrFrDrrsrFrceZdZfdZxZS)rcN||_t|	d|jdy)Nzmember z has an absolute pathr>r<rrrr>r?s  rDrzAbsolutePathError.__init__s&
77<<"22GHIrFr@rBs@rDrrsJJrFrceZdZfdZxZS)rcf||_||_t|
|jd|ddzy)Nz would be extracted to ,  which is outside the destinationr>_pathr<rrrr>r/r?s   rDrz OutsideDestinationError.__init__s;

GLL++B4("M=>	?rFr@rBs@rDrr
??rFrceZdZfdZxZS)rcL||_t|	|jdy)Nz is a special filerFrGs  rDrzSpecialFileError.__init__s$
GLL++=>?rFr@rBs@rDrrs@@rFrceZdZfdZxZS)rcL||_t|	|jdy)Nz is a link to an absolute pathrFrGs  rDrzAbsoluteLinkError.__init__s$
GLL++IJKrFr@rBs@rDrrsLLrFrceZdZfdZxZS)rcf||_||_t|
|jd|ddzy)Nz would link to rJrKrLrNs   rDrz$LinkOutsideDestinationError.__init__s:

GLL+?4("E=>	?rFr@rBs@rDrrrOrFrci}|j}tjj|}|j	dtj
fr1|jj
dtj
zx}|d<tjj|rt|tjjtjj||}tjj||g|k7rt|||j}|y|dz}|r^|js|jr|dzs|dz}|dz}n.|js|j!rd}nt#|||jk7r||d<|rk|j$d|d<|j&d|d	<|j(d|d
<|j*d|d<|js|j!rtjj|j,rt/||j!rItjj|tjj1||j,}n*tjj||j,}tjj|}tjj||g|k7rt3|||S)N/ri@irr3r4r5r6)rrr/realpathrseplstripisabsrr
commonpathrrisregislnkisdirissymrr3r4r5r6linknamerdirnamer)member	dest_pathfor_data	new_attrsrtarget_pathrs       rD_get_filtered_attrsrjs^I;;D  +IRVV}%#);;#5#5cBFFl#CCy 	ww}}T ''''""277<<	4#@AK	ww;	23y@%fk::;;De|||~e|FND
6<<>'v..6;; $If::!#Ie::!#Ie<<#!%Ig<<#!%Ig<<>V\\^ww}}V__-'//||~ ggll9+-77??4+@+1??<!ggll9+1??<''**;7Kww!!;	":;yH1&+FFrFc|Srr)rerfs  rDrr1sMrFcPt||d}|r|jdi|ddiS|S)NFdeeprrjrrerfrhs   rDrr4s1#FIu=Iv~~6	666MrFcPt||d}|r|jdi|ddiS|S)NTrmFrrnros   rDrr:s1#FIt<Iv~~6	666MrF)
fully_trustedrr1cBeZdZdZedTidddddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d%d'd%ZdUd(Zed)Zejd*Zed+Z
e
jd,Z
d-Zeeeeeeeed.ed/
d0Z
d1Zeed2fd3Zd4Zd5Zd6Zed7Zd8Zed9Zed:Zed;Zed<Zed=Zed>Zd?Zd@Z dAZ!dBZ"dCZ#dDZ$dEZ%dFZ&dGZ'dHZ(dIZ)dJZ*dKZ+dLZ,dMZ-dNZ.dOZ/dPZ0dQZ1dRZ2dSZ3y%)VraInformational 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.
    rzName of the archive member.rzPermission bits.r3z6User ID of the user who originally stored this member.r4z7Group ID of the user who originally stored this member.r1zSize in bytes.r2zTime of last modification.chksumzHeader checksum.typezFile type. type is usually one of these constants: REGTYPE, AREGTYPE, LNKTYPE, SYMTYPE, DIRTYPE, FIFOTYPE, CONTTYPE, CHRTYPE, BLKTYPE, GNUTYPE_SPARSE.rczcName of the target file name, which is only present in TarInfo objects of type LNKTYPE and SYMTYPE.r5z
User name.r6zGroup name.devmajorzDevice major number.devminorzDevice minor number.rzThe tar header starts here.r:zThe file's data starts here.pax_headerszMA dictionary containing key-value pairs of an associated pax extended header.r;zSparse member information.r=N_sparse_structs_link_targetc||_d|_d|_d|_d|_d|_d|_t|_d|_	d|_
d|_d|_d|_
d|_d|_d|_i|_y)zXConstruct a TarInfo object. name is the optional name
           of the member.
        irrN)rrr3r4r1r2rsREGTYPErtrcr5r6rurvrr:r;rwrrs  rDrzTarInfo.__init__ps}			
	




rFc|jS)z(In pax headers, "name" is called "path".rrs rDr/zTarInfo.pathsyyrFc||_yrr~r|s  rDr/zTarInfo.paths		rFc|jS)z0In pax headers, "linkname" is called "linkpath".rcrs rDr0zTarInfo.linkpathr'rFc||_yrr)rrcs  rDr0zTarInfo.linkpaths	 
rFc`d|jj|jt|fzS)Nz<%s %r at %#x>)r?rridrs rD__repr__zTarInfo.__repr__s&4>>#:#:499RX"NNNrFT)
rr2rrcr3r4r5r6rm_KEEPc
|	rtj|}ntj|}||
ur||_||
ur||_||
ur||_||
ur||_||
ur||_||
ur||_||
ur||_||
ur||_	|S)zGReturn a deep copy of self with the given attributes replaced.
        )
copydeepcopyrr2rrcr3r4r5r6)rrr2rrcr3r4r5r6rmrresults            rDrzTarInfo.replaces]]4(FYYt_FuFK FLuFK5 &FOeFJeFJ FL FL
rFc|jd}n|jdz}|j||j|j|j|j
|j|j|j|j|j|j|jd
}|dtk(r!|djds
|dxxdz
cc<|S)z9Return the TarInfo's attributes as a dictionary.
        N)
rrr3r4r1r2rsrtrcr5r6rurvrtrrW)rrr3r4r1r2rsrtrcr5r6rurvDIRTYPEr)rrinfos   rDget_infozTarInfo.get_infos99D99v%D				

		










 <7"4<+@+@+ELCLrFsurrogateescapec.|j}|jD]\}}|	td|z|tk(r|j	|||S|t
k(r|j
|||S|tk(r|j||Std)z<Return a tar header as a string of 512 byte blocks.
        z%s may not be Nonezinvalid format)	ritemsr<rcreate_ustar_headerrcreate_gnu_headerrcreate_pax_header)rrbrBrCrrvalues       rDtobufz
TarInfo.tobufs}}::<	>KD%} !5!<==	>\!++D(FCC
z
!))$&AA
z
!))$99-..rFc,t|d<t|dj||tkDrt	dt|dj||t
kDr|j
|d||\|d<|d<|j|t||S)z3Return the object as a ustar header block.
        magicrczlinkname is too longrprefix)	POSIX_MAGICr>r=LENGTH_LINKr<LENGTH_NAME_posix_split_name_create_headerr)rrrBrCs    rDrzTarInfo.create_ustar_headers$W
tJ&&x89KG344tF|""8V45C+/+A+A$v,PXZ`+a(DNDL""4xHHrFcZt|d<d}t|dj||tkDr||j	|dt
||z
}t|dj||tkDr||j	|dt||z
}||j|t||zS)z:Return the object as a GNU header block sequence.
        rrFrcr)
	GNU_MAGICr>r=r_create_gnu_long_headerGNUTYPE_LONGLINKrGNUTYPE_LONGNAMErr)rrrBrCrks     rDrzTarInfo.create_gnu_headers"W
tJ&&x89KG4//Z0@BRT\^deeCtF|""8V45C4//V>NPXZ`aaCT((z8VLLLrFc\t|d<|jj}ddtfddtfddfD];\}}}||vr	||jdd	t|||kDs4||||<=d
D]e\}}d}||}	t|	t}
|
rt|	n|	}d|cxkrd
|dz
zks
nd||<d}n	|
r|||<d}|sS||vsXt|	||<g|r|j|t|}nd}||j|tddzS#t$r||||<YwxYw)zReturn the object as a ustar header block. If it cannot be
           represented this way, prepend a pax extended header sequence
           with supplement information.
        rrr/rcr0)r5r5 )r6r6rrRrS))r3rP)r4rP)r1)r2rFrrPr-TrFr)rrwrrrr=UnicodeEncodeErrorr>
isinstancefloatroundstr_create_pax_generic_headerXHDTYPErr)
rrrBrwrhnamerAra	needs_paxvalval_is_floatval_intrks
             rDrzTarInfo.create_pax_headers
$W
&&++-
-
J/T&(>$@	0D%#
T
!!'84
4:'%)$ZE"!	0(R	-LD&It*C%c51L$0eCjcG3!
"33T
 	%T
 	T4$'HD!%	-*11+wQCCT((|WiPPPG&
%)$ZE"
sDD+*D+c0|j|tdS)zAReturn the object as a pax global header block sequence.
        r:)rXGLTYPE)clsrws  rDcreate_pax_global_headerz TarInfo.create_pax_global_header;s--k7GLLrFcR|jd}tdt|D]t}dj|d|}dj||d}t|j	||t
ksNt|j	||tksq||fStd)zUSplit a name longer than 100 chars into a prefix
           and a name part.
        rWr-Nzname is too long)splitrVr>rr=
LENGTH_PREFIXrr<)rrrBrC
componentsr[rs       rDrzTarInfo._posix_split_nameAsZZ_
q#j/*	1AXXj!n-F88JqrN+D6==623}DHf56+Et|	1/00rFch|jdttfv}|r;t|jddd|}t|jddd|}nt	dd||}t	dd||}|jdt
}|t
dt	|jd	dd
||t|jdddzd|t|jd
dd|t|jddd|t|jddd|t|jddd|d|t	|jddd
|||jdtt	|jddd||t	|jddd||||t	|jddd||g}tjdtzdj|}	t|	tdd}
|	ddtd|
zdz|	ddz}	|	S) zReturn a header block. info is a dictionary with file
           information, format must be one of the *_FORMAT constants.
        rtrurrPrvrNzTarInfo.type must not be Nonerrrrr3r4r1rr2s        rcrr5rr6rrz%dsrFiz%06orRi)getCHRTYPEBLKTYPErdrEr{r<rrirrrrnr^)rrbrBrChas_device_fieldsrurvfiletypepartsrkrss           rDrzTarInfo._create_headerQs
!HHV,'0BB488J2Av>H488J2Av>H2q(F3H2q(F3H88FG,<==
$c8V<#f,a8"Av."Av.#R0!$b&1R(#x@HHWk*"%r8V<"%r8V<2&Xv>
$kk%)+SXXe_=c9*+./2%4j5F!2G<<s45zI
rFcntt|t\}}|dkDr|t|z
tzz
}|S)zdReturn the string payload filled with zero bytes
           up to the next 512 byte border.
        r)rsr>rr?)payloadrzr{s   rD_create_payloadzTarInfo._create_payload{s9
#3w<;	q=	I-44GrFc|j||tz}i}d|d<||d<t||d<t|d<|j	|t
|||j
|zS)zTReturn a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence
           for name.
        z
././@LongLinkrrtr1r)r=r?r>rrrr)rrrtrBrCrs      rDrzTarInfo._create_gnu_long_headerst
{{8V,s2&VV4yV!W
!!$hG##D)*	*rFcd}|jD]\}}	|jddd}|r|dz
}|jD]\}}|jd}|r|j|d}n|jd}t|t|zdz}d	x}	}
	|tt	|
z}	|	|
k(rn|	}
 |tt	|
d
dz|zdz|zd
zz
}i}d|d<||d<t||d<t|d<|j|td
d|j|zS#t$rd}YwxYw)zReturn a POSIX.1-2008 extended or global header sequence
           that contains a list of keyword, value pairs. The values
           must be strings.
        Fr:rSTrFs21 hdrcharset=BINARY
rrrrR =
z././@PaxHeaderrrtr1rr)
rr=rr>rr^rrrr)rrwrtrBbinarykeywordrrecordslrZrKrs            rDrz"TarInfo._create_pax_generic_headers)//1	NGU
Wh/	00G)//1	VNGUnnW-GX/@AW-Gs5z)A-AIACFO6	

uSVW-4w>EMPUUUG!	V('VV7|V#W
!!$gyI##G,-	-I&

sD99E	E	clt|dk(rtdt|tk7rtd|j	t
tk(rt
dt|dd}|t|vrtd|}t|dd|||_t|dd	|_t|d	d
|_
t|d
d|_t|dd|_t|dd|_||_|dd
|_t|d
d|||_t|dd|||_t|dd|||_t|dd|_t|dd|_t|dd||}|j$t0k(r&|jj3drt4|_|j$t6k(rxd}g}t9dD]@}		t|||dz}
t||dz|dz}|j=|
|f|dz
}Bt?|d}t|dd}
|||
f|_ |jCr |jjEd|_|r)|j$tFvr|dz|jz|_|S#t:$rYwxYw)zAConstruct a TarInfo object from a 512 byte bytes object.
        rzempty headerztruncated headerzend of file headerzbad checksumrlt|ii	i)iIiQiYirWirriii)$r>rrrcountr?rr\rnrYrLrrr3r4r1r2rsrtrcr5r6rurvAREGTYPErrGNUTYPE_SPARSErVr<rboolrxrarstrip	GNU_TYPES)rrkrBrCrsobjrrstructsr[rnumbytes
isextendedorigsizes              rDfrombufzTarInfo.frombufss8q=">22s8y &'9::99S>Y& !566SS\"c**$^44es1Sz8V4s3s|$c#cl#c#cl#s3s|$C%	
s3<3s3<6:Ch7	Ch7	3s3<(3s3<(SS\8V488xCHH$5$5c$:CH
88~%CG1X
 Sr!23F"3sRxb#9:H12r	
c#hJ3s3<(H#*J"AC99;xxs+CHchhi/|chh.CH
"s$%J&&	J32J3c|jjt}|j||j|j
}|jj
tz
|_|j|S)zOReturn the next TarInfo object from TarFile object
           tarfile.
        )	rrtrrrBrCrr_proc_member)rr=rkrs    rDfromtarfilezTarInfo.fromtarfiles^
oo""9-kk#w//@__))+i7
((rFc|jttfvr|j|S|jtk(r|j|S|jtttfvr|j|S|j|S)zYChoose the right processing method depending on
           the type and call it.
        )rtrr
_proc_gnulongr_proc_sparserrSOLARIS_XHDTYPE	_proc_pax
_proc_builtin)rr=s  rDrzTarInfo._proc_membersx99)+;<<%%g..
YY.
($$W--
YY7G_=
=>>'**%%g..rFc|jj|_|j}|js|jt
vr||j
|jz
}||_|j|j|j|j|jr |jjd|_|S)zfProcess a builtin type or an unknown type which
           will be treated as a regular file.
        rW)rrr:r_rtSUPPORTED_TYPES_blockr1r_apply_pax_inforwrBrCrarr)rr=rs   rDrzTarInfo._proc_builtin*s#??//1!!::<499O;dkk$)),,F	
W00'2B2BGNNS::<		((-DIrFcF|jj|j|j}	|j	|}|j|_|jtk(r't||j|j|_n9|jtk(r&t||j|j|_|j#r |jj%d|_|S#t
$r}t
t|dd}~wwxYw)zSProcess the blocks that hold a GNU longname
           or longlink member.
        NrW)rrtrr1rrrrrrtrrLrBrCrrrcraremovesuffix)rr=rknextrs     rDrzTarInfo._proc_gnulong@soo""4;;tyy#9:	:##G,Dkk99((C!1!17>>BDI
YY*
*W%5%5w~~FDM::<		..s3DI!	:'A/T9	:sC==	D DD c
|j\}}}|`|r|jjt}d}t	dD]D}	t|||dz}t||dz|dz}	|r|	r|j||	f|dz
}Ft|d}|r||_	|jj|_|j|j|jz|_||_
|S#t$rYywxYw)z8Process a GNU sparse header plus extra headers.
        rrri)rxrrtrrVr\r<rrr;rr:rr1r)
rr=rrrrkrr[rrs
          rDrzTarInfo._proc_sparse[s)-(<(<%X //&&y1CC2Y
 Sr!23F"3sRxb#9:HhNNFH#56r	
c#hJ"??//1))DKK		,BB	"s%C55	DDcV|jj|j|j}|jt
k(r
|j}n|jj}tjd|}|#|jdjd|d<|jd}|dk(r
|j}nd}tjd}d}|j||x}r|j!\}	}
t#|	}	|	dk(rt%d	||j'd
dz|j)d|	zdz
}|j+|
dd|j,}
|
t.vr)|j+|||j|j,}n|j+|dd|j,}|||
<||	z
}|j||x}r	|j1|}d|vr|j9||nSd|vr|j;|||n;|jd
dk(r'|jddk(r|j=||||jt>t@fvr|jC||j|j,|jD|_"d|vrS|jF}|jIs|jtJvr||j|jz
}||_"|S#t2$r}
t5t7|
dd}
~
wwxYw)zVProcess an extended or global header as described in
           POSIX.1-2008.
        s\d+ hdrcharset=([^\n]+)\nNr-r:
hdrcharsetBINARYs(\d+) ([^=]+)=rrUr.GNU.sparse.mapGNU.sparse.sizezGNU.sparse.major1zGNU.sparse.minorrTr1)&rrtrr1rtrrwrresearchgrouprJrrBcompilematchgroupsrWrYrr2_decode_pax_fieldrCPAX_NAME_FIELDSrrrr_proc_gnusparse_01_proc_gnusparse_00_proc_gnusparse_10rrrrr:r_r)rr=rkrwrrrBregexrrArrrrrs               rDrzTarInfo._proc_paxws
oo""4;;tyy#9:
99!--K!--224K		7=(-A(=(=g(FK%
!__\2
!''HH

-.{{3,,e,#llnOFG[F{()9::		!q(Q&)@1)DEE,,WgwNN$G/)..uh@P@P(..ugw($)K 6MC1{{3,,e,6	:##G,D
{*##D+6
+
-##D+s;
__/
0C
7KOOL^<_cf<f##D+w?99/22  g.>.>O++DK$))::<499O#Cdkk$))44F!'=	:'A/T9	:s!L	L(L##L(cPg}tjd|D]+}|jt|j	d-g}tjd|D]+}|jt|j	d-tt
|||_y)z?Process a GNU tar extended sparse header, version 0.0.
        s\d+ GNU.sparse.offset=(\d+)\nr-s\d+ GNU.sparse.numbytes=(\d+)\nN)rfinditerrrWrlistzipr;)rrrwrkoffsetsrrs       rDrzTarInfo._proc_gnusparse_00s[[!BCH	0ENN3u{{1~./	0[[!DcJ	1EOOCA/0	13w12rFc	|djdDcgc]
}t|}}tt|ddd|ddd|_ycc}w)z?Process a GNU tar extended sparse header, version 0.1.
        r,Nr.r-)rrWr
rr;)rrrwxr;s     rDrzTarInfo._proc_gnusparse_01sW#..>"?"E"Ec"JKQ#a&KK3vcc{F14a4L9:LsAc	d}g}|jjt}|jdd\}}t	|}t||dzkrgd|vr"||jjtz
}|jdd\}}|j
t	|t||dzkrg|jj|_tt|ddd|ddd|_y)z?Process a GNU tar extended sparse header, version 1.0.
        Nrr-r.)rrtrrrWr>rrr:r
rr;)rrrwr=fieldsr;rknumbers        rDrzTarInfo._proc_gnusparse_10soo""9-iiq)V&kFQJ&Cw++I66))E1-KFCMM#f+&	&kFQJ&
#??//13vcc{F14a4L9:rFc|jD]\}}|dk(rt|d||dk(rt|dt|5|dk(rt|dt|Q|tvsZ|tvr	t	||}|dk(r|j
d}t||||j|_y#t
$rd}YHwxYw)	zoReplace fields with supplemental information from a previous
           pax extended or global header.
        zGNU.sparse.namer/rr1zGNU.sparse.realsizerrWN)	rsetattrrW
PAX_FIELDSPAX_NUMBER_FIELDSr<rrrw)rrwrBrCrrs      rDrzTarInfo._apply_pax_infos*//1	.NGU++fe,--fc%j111fc%j1J&//" 1' :5 Af$!LL-Egu-	."'++-
&" !"s4B==C
Ccj	|j|dS#t$r|j||cYSwxYw)z1Decode a single field from a pax record.
        rS)rJUnicodeDecodeError)rrrBfallback_encodingfallback_errorss     rDrzTarInfo._decode_pax_fields<	D<<(33!	D<< 1?CC	Ds22cHt|t\}}|r|dz
}|tzS)z_Round up a byte count by BLOCKSIZE and return it,
           e.g. _block(834) => 1024.
        r-)rsr)rrrzr{s    rDrzTarInfo._blocks,#5)4	aKF	!!rFc&|jtvSz4Return True if the Tarinfo object is a regular file.)rt
REGULAR_TYPESrs rDr_z
TarInfo.isreg$syyM))rFc"|jSr)r_rs rDisfilezTarInfo.isfile(szz|rFc(|jtk(S)z!Return True if it is a directory.)rtrrs rDraz
TarInfo.isdir,yyG##rFc(|jtk(S)z%Return True if it is a symbolic link.)rtSYMTYPErs rDrbz
TarInfo.issym0r"rFc(|jtk(S)z!Return True if it is a hard link.)rtLNKTYPErs rDr`z
TarInfo.islnk4r"rFc(|jtk(S)z(Return True if it is a character device.)rtrrs rDischrz
TarInfo.ischr8r"rFc(|jtk(S)z$Return True if it is a block device.)rtrrs rDisblkz
TarInfo.isblk<r"rFc(|jtk(S)zReturn True if it is a FIFO.)rtFIFOTYPErs rDisfifozTarInfo.isfifo@syyH$$rFc|jduSr)r;rs rDissparsezTarInfo.issparseDs{{$&&rFc<|jtttfvS)zCReturn True if it is one of character device, block device or FIFO.)rtrrr,rs rDisdevz
TarInfo.isdevGsyyWgx888rFr)r)4rrrrdict	__slots__rpropertyr/setterr0rrrrrr
rrrrclassmethodrrstaticmethodrrrrrrrrrrrrrrrrrr_r rarbr`r(r*r-r/r1rrFrDrrMs
,
!
G
H	

 
-

$
>
F


*
 *!
"/#
$5%
&9'
*.+
,-
./
01
I60
[[__!!O%eeuE88*HEV/"IM8QtMM
 ''R** 0-0-d<<|))(/,68bH	3;; ..D"*$$$$$%'9rFrceZdZdZdZdZdZdZeZ	e
ZdZe
ZeZdZ				d8dZedddefdZed9d	Zed:d
Zed:dZed;dZd
ddddZdZdZdZdZd<dZd=dddZ d>dddZ!d?dZ"dZ#d@ddddZ$dAddddZ%d Z&d!Z'd"Z(d#Z)d$Z*		dBd%Z+d&Z,d'Z-d(Z.d)Z/d*Z0d+Z1d,Z2d-Z3d.Z4d/Z5dCd0Z6d1Z7d?d2Z8d3Z9d4Z:d5Z;d6Z<d7Z=y)Drz=The TarFile Class provides an interface to tar archives.
    rFr-Nrcddddd}||vrtd||_|||_|sZ|jdk(r-tjj|sd|_d|_t
||j}d	|_n^|8t|dr,t|jttfr|j}t|dr|j|_d
|_|rtjj|nd
|_
||_|||_|||_|||_|||_|||_|	|_|
|jt*k(r|
|_ni|_|||_|||_|
|_d	|_g|_d	|_|jj;|_i|_	|jdk(rd
|_ |jC|_ |jdk(r^	|jjE|j<	|j jG|}|j6jI|]|jdvrd
|_|j,rm|j jQ|j,jS}|jjU||xj<tW|z
c_y
y
y
#tJ$r(|jjE|j<YtL$r}tOt|d
d
}~wwxYw#|js|jjYd
|_xYw)aOpen 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.
        rbzr+bwbxbrarr!mode must be 'r', 'a', 'w' or 'x'r>rFNrrTrr>rr)-r<r_moderr/exists	bltn_openrrrrrr^abspathrrbr>dereferenceignore_zerosrBrCrrwdebug
errorlevelcopybufsizermembers_loadedrrinodesfirstmemberrrrrrrrrrrur>r)rrrrrbr>rErFrBrCrwrGrHrImodesrrks                 rDrzTarFile.__init__hsT=u@AA	4[
yyCt(<	!
djj1G$D&!97<<#u6||w'$\\
#D-1BGGOOD)t	 DK"DL"*D# ,D$DM"t{{j'@*D!DDJ!(DO'll'')	yyC#' #'99; yyCLL%%dkk2:"&,,":":4"@++G4	yyO+###,,??@P@P@U@U@WXCLL&&s+KK3s8+K$,
*))$++6&:'A/T9:	##""$DKs>>A L;6K&BL;&.L8L;L8L33L88L;;0M+c|s
|std|dvrzfd}g}tj|D]:}tj|}	||j	}
	|	|d|fi|cSd	j|}td
|d|vrb|jdd\}
}|
xsd}
|xsd
}|jvrtj|}	nt
d|z|	||
|fi|Sd|vrg|jdd\}
}|
xsd}
|xsd
}|
dvrtd|jdd}t||
||||}	||
|fi|}d|_|S|dvrj|||fi|Std#t
tf$r5}|jd|d|||j
Yd}~d}~wwxYw#|jxYw)aOpen a tar archive for reading, writing or appending. Return
           an appropriate TarFile class.

           mode:
           'r' or '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
           'r:xz'       open for reading with lzma compression
           'a' or 'a:'  open for appending, creating the file if necessary
           'w' or 'w:'  open for writing without compression
           'w:gz'       open for writing with gzip compression
           'w:bz2'      open for writing with bzip2 compression
           'w:xz'       open for writing with lzma compression

           'x' or 'x:'  create a tarfile exclusively without compression, raise
                        an exception if the file is already created
           'x:gz'       create a gzip compressed tarfile, raise an exception
                        if the file is already created
           'x:bz2'      create a bzip2 compressed tarfile, raise an exception
                        if the file is already created
           'x:xz'       create an lzma compressed tarfile, raise an exception
                        if the file is already created

           'r|*'        open a stream of tar blocks with transparent 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
           'r|xz'       open an lzma 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
           'w|xz'       open an lzma compressed stream for writing
        znothing to open)rr:*c(j|dk(S)Ntaropen)	OPEN_METH)rrs rDnot_compressedz$TarFile.open.<locals>.not_compresseds}}X.);;rF)keyNrz	- method z: 
z'file could not be opened successfully:
:r-rr|rzmode must be 'r' or 'w'r	Fr@zundiscernible mode)r<sortedrSrrrr	rrrrpoprrrrR)rrrrrykwargsrT
error_msgsrfunc	saved_posrerror_msgs_summaryfilemoderstreamrs`                rDrzTarFile.opens9JG.//<
<J"3==nE

sCMM($;<& 'Ic7=f==

"&:!6FGYFZ[\\
D[!%C!3Hh3H(5H3==(sCMM($;<&'Dx'OPPh:6::
D[!%C!3Hh3H(5Hz) !:;;"JJ:MT8Xw*,F
h9&9"AMH
_
$3;;tT7=f==-..W"#34%%	(2aU&CD*Y/	D
s$"
FGG*GGGc6|dvrtd||||fi|S)zCOpen uncompressed tar archive name for reading or writing.
        r=r?)r<)rrrrr\s     rDrRzTarFile.taropen7s-++@AA4w1&11rFc|dvrtd	ddlm}	|||dz||}	|j|||fi|}d
|_	|S#t$r
t	ddwxYw#t
$r}||dk(rt
d	|d}~wwxYw#t
$r'}|j|dk(rt
d	|d}~w|jxYw)zkOpen gzip compressed tar archive name for reading or writing.
           Appending is not allowed.
        rrrmode must be 'r', 'w' or 'x'r)GzipFilezgzip module is not availableNr|rrF)
r<gziprgrr	rrrRrr)	rrrrrr\rgrrs	         rDgzopenzTarFile.gzopen?s
&;<<	M%	tTCZHG		D$:6:A
+	M"#ABL	M
	"ts{ 129		MMOs{ 129	MMOs9AABA	B'A;;B	C"B..CcP|dvrtd	ddlm}||xs|||}	|j
|||fi|}d
|_
|S#t$r
t	ddwxYw#ttf$r'}|j|dk(rtd	|d}~w|jxYw)zlOpen bzip2 compressed tar archive name for reading or writing.
           Appending is not allowed.
        rerfr)BZ2FilerN)rrznot a bzip2 fileF)r<rrkrr	rRrEOFErrorrrr)	rrrrrr\rkrrs	         rDbz2openzTarFile.bz2open`s
&;<<	L#'/T4}M		D$:6:A
!	L"#@AtK	L"	MMOs{ 23:	MMOs"AAAB%-"BB%cL|dvrtd	ddlm}m}||xs|||}	|j|||fi|}d
|_
|S#t$r
tddwxYw#|tf$r'}	|j|dk(rtd	|	d}	~	w|jxYw)zkOpen lzma compressed tar archive name for reading or writing.
           Appending is not allowed.
        rerfr)LZMAFilerrN)presetrznot an lzma fileF)r<rrorrr	rRrlrrr)
rrrrrpr\rorrrs
          rDxzopenzTarFile.xzopen|s
&;<<	M07?dD@		D$:6:A
!	M"#ABL	M8$	MMOs{ 23:	MMOs"AA A B#+"B

B#rRrirmrq)rrrrc|jryd|_	|jdvr|jjtt
dzz|xjt
dzz
c_t|jt\}}|dkDr)|jjtt|z
z|js|jjyy#|js|jjwwxYw)zlClose the TarFile. In write-mode, two finishing zero blocks are
           appended to the archive.
        NTr@r.r)rrrrur?rrrs
RECORDSIZErr)rrzr{s   rDrz
TarFile.closes;;	%yyO+""3)a-#89	A
.%+4;;
$C!	q=LL&&sj9.D'EF##""$$4##""$$sBC)Dcf|j|jd}|td|z|S)aReturn 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 occurrence is assumed to be the
           most up-to-date version.
        rWzfilename %r not found)
_getmemberrKeyError)rrr>s   rD	getmemberzTarFile.getmembers6//$++c"23?2T9::rFcr|j|js|j|jS)zReturn the members of the archive as a list of TarInfo objects. The
           list has the same order as the members in the archive.
        )_checkrK_loadrJrs rD
getmemberszTarFile.getmemberss'	

||JJL||rFc\|jDcgc]}|jc}Scc}w)zReturn the members of the archive as a list of their names. It has
           the same order as the list returned by getmembers().
        )r{r)rr>s  rDgetnameszTarFile.getnamess#-1OO,=>>>>s)c.|jd||j}||}tjj	|\}}|jtjd}|jd}|j}||_	|8|jstj|}n9tj|}n#tj|j}d}|j}tj |r|j"|j$f}	|jsE|j&dkDr6|	|j(vr(||j(|	k7rt*}
|j(|	}nt,}
|	dr||j(|	<ntj.|rt0}
ntj2|rt4}
njtj6|rt8}
tj:|}n9tj<|rt>}
ntj@|rtB}
ny||_||_"|jF|_$|jJ|_&|
t,k(r|jN|_(nd|_(|jR|_*|
|_+||_,tZr(	t[j\|jHd|_/tbr(	tcjd|jLd|_3|
t>tBfvrhtitdrXtitdrHtjj|jl|_7tjp|jl|_9|S#t`$rYwxYw#t`$rYwxYw)	aCreate a TarInfo object from the result of os.stat or equivalent
           on an existing file. The file is either named by `name', or
           specified as a file object `fileobj' with a file descriptor. If
           given, `arcname' specifies an alternative name for the file in the
           archive, otherwise, the name is taken from the 'name' attribute of
           'fileobj', or the 'name' argument. The name should be a text
           string.
        awxNrWrr-rmajorminor):ryrrr/
splitdriverr[r\r>r=rElstatstatfstatfilenost_modeS_ISREGst_inost_devst_nlinkrLr&r{S_ISDIRrS_ISFIFOr,S_ISLNKr$readlinkS_ISCHRrS_ISBLKrrst_uidr3st_gidr4st_sizer1st_mtimer2rtrcpwdgetpwuidr5rvgrpgetgrgidr6rrst_rdevrurrv)rrarcnamerdrvr>statresrcstmdinoderts           rD
gettarinfozTarFile.gettarinfos	
E<<D
?Gww))'2W//"&&#...%,,.?##((4.''$-hhw~~/0G<<^^W^^4E##(8(81(<T[[(WE8J-J;;u-8)0DKK&
\\$
D
]]4
 D
\\$
D{{4(H
\\$
D
\\$
Dnnnn7?"??GLGL((
#
 #W[[ 9! <

 #W[[ 9! <
GW%%r7#G(<#%88GOO#< #%88GOO#< 




s$,'M9'N9	NN	NN)rJc|j||}|D]}|r&|jtdn(ttj|jt|j
xs|jd|jxs|j|js|jr(tdd|j|jfzzntd|jz|jtdn.tdtj |jdd	zt|j"|j%rdnd
z|rP|j'rtd|j(z|j+rtd|j(zt-y)
aPrint 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. `members' is optional and must be a subset of the
           list returned by getmembers().
        Nz
??????????rWz%10sz%d,%dz%10dz????-??-?? ??:??:??z%d-%02d-%02d %02d:%02d:%02drrz-> zlink to )ryrrrrar5r3r6r4r(r*rurvr1r2r	localtimerrarbrcr`r)rverboserJr>s    rDr
zTarFile.list6sk	

?G	G<<'-

gll ;<w}}'C'C'.}}'C'CEF==?gmmo$(8(8':J:J'KK!MN  56==( 56 ="&.."?"C!DE
w}}BGH==?(8(8 89==?
W-=-= =>G5	rFfiltercb|jd||}|jBtjj	||jk(r|jdd|zy|jd||j
||}||jdd|zy| ||}||jdd|zy|jr(t|d5}|j||dddy|jr|j||ruttj|D]S}|jtjj||tjj||||	Uyy|j|y#1swYyxYw)
a!Add 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. `filter' is a function
           that expects a TarInfo object argument and returns the changed
           TarInfo object, if it returns None the TarInfo object will be
           excluded from the archive.
        rNr.ztarfile: Skipped %rr-ztarfile: Unsupported type %rtarfile: Excluded %rr:r)ryrrr/rD_dbgrr_rCaddfilerarZlistdiraddr)rrr	recursiverr>fs       rDrzTarFile.add\s	
E?G99 RWW__T%:dii%GIIa.56		!T//$0?IIa7$>?WoG		!3d:;==?4&
)!Wa(
)
)]]_LL!

4 016AHHRWW\\$2BGGLL!4L%f66
LL!
)
)sF%%F.c|jdtj|}|j|j|j|j
}|jj||xjt|z
c_|j}|t||j|j|t|jt\}}|dkDr.|jjtt|z
z|dz
}|xj|tzz
c_|j j#|y)aAdd the TarInfo object `tarinfo' to the archive. If `fileobj' is
           given, it should be a binary file, and tarinfo.size bytes are read
           from it and added to the archive. You can create TarInfo objects
           directly, or by using gettarinfo().
        rN)ryrr-)ryrrrbrBrCrrurr>rIrrr1rsrr?rJr)rr>rrkryrzr{s       rDrzTarFile.addfiles	
E))G$mmDKKD3s3x  w||WM &w||Y ?FI1}""3)i*?#@A!KK6I--KG$rFc|K|j}| tjdttSt|trtd|St|r|S	t|S#t$rtd|ddwxYw)NzPython 3.14 will, by default, filter extracted tar archives and reject files or modify their metadata. Use the filter argument to control this behavior.zrString names are not supported for TarFile.extraction_filter. Use a function such as tarfile.data_filter directly.zfilter z
 not found)extraction_filterwarningswarnDeprecationWarningrrr	TypeErrorcallable_NAMED_FILTERSrvr<)rrs  rD_get_filter_functionzTarFile._get_filter_functions>++F~

J'	(
,+&#&677MFM	G!&))	Gwvj
;<$F	GsA%%A?)
numeric_ownerrc@g}|j|}||}|D]]}|j|||}||jr|j||j	|||j|_|jdd|D]e}tjj||j}		|j||	||j||	|j||	gy#t$r}
|j|
Yd}
~
d}
~
wwxYw)aExtract all members from the archive to the current working
           directory and set owner, modification time and permissions on
           directories afterwards. `path' specifies a different directory
           to extract to. `members' is optional and must be a subset of the
           list returned by getmembers(). If `numeric_owner` is True, only
           the numbers for user/group names are used and not the names.

           The `filter` function will be called on each member just
           before extraction.
           It can return a changed TarInfo or None to skip the member.
           String names of common filters are accepted.
        N	set_attrsrc|jSrr~)r>s rD<lambda>z$TarFile.extractall.<locals>.<lambda>s
qvvrFT)rUreverse)r)r_get_extract_tarinforar_extract_onesortrr/rrchownutimechmodr_handle_nonfatal_error)rr/rJrrdirectoriesfilter_functionrer>dirpathrs           rD
extractallzTarFile.extractalls!33F;?G
	;F//NG}}""7+gt7==?7J,9

;
	;	-t<#	/Gggll46G
/

7G=
I

7G,

7G,	/ 
/++A..
/s>8C99	DDDcz|j|}|j|||}||j||||yy)aExtract 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'. File attributes (owner,
           mtime, mode) are set unless `set_attrs' is False. If `numeric_owner`
           is True, only the numbers for user/group names are used and not
           the names.

           The `filter` function will be called before extraction.
           It can return a changed TarInfo or None to skip the member.
           String names of common filters are accepted.
        N)rrr)rrer/rrrrr>s        rDextractzTarFile.extractsG33F;++FOTJgtY
FrFct|tr|j|}n|}|}	|||}| |jdd|jzy|jrDtj|}tjj||j|_|S#ttf$r}|j|Yd}~d}~wt$r}|j|Yd}~d}~wwxYw)z@Get filtered TarInfo (or None) from member, which might be a strNr.r)rrrwrr_handle_fatal_errorrrrrr`rrr/rrcry)rrerr/r>
unfilteredrs       rDrzTarFile._get_extract_tarinfosfc"nnV,GG
	+%gt4G
?IIa/*//AB==?ii(G#%77<<g6F6F#GG %	($$Q''	+''**	+s#	B))C58CC5C00C5c4|jd	|j|tjj	||j
||y#t$r}|j|Yd}~yd}~wt$r}|j|Yd}~yd}~wwxYw)z%Extract from filtered tarinfo to diskrrN)
ry_extract_memberrr/rrrrrr)rr>r/rrrs      rDrzTarFile._extract_one	sC	+  "'',,tW\\*J+4/<
!
>	($$Q''	+''**	+s#=A	BA00B<BBcN|jdkDr|jdd|zy)z=Handle non-fatal error (ExtractError) according to errorlevelr-tarfile: %sN)rHrrrs  rDrzTarFile._handle_nonfatal_error#	s$??QIIa*+rFcL|jdkDrt|trY|j |j	dd|j
zy|j	dd|j
d|jy|j	ddt
|jd|y)z1Handle "fatal" error according to self.errorlevelrNr-rz	tarfile: r)rHrrfilenamerstrerrorrtrrs  rDrzTarFile._handle_fatal_error*	st??Q
7
#zz!		!]QZZ78		!QZZHIIIaT!W-=-=qABrFc|jdt|tr|j|}n|}|j	s|j
tvr|j||S|js|jrEt|jtrtd|j|j|Sy)a\Extract a member from the archive as a file object. `member' may be
           a filename or a TarInfo object. If `member' is a regular file or
           a link, an io.BufferedReader object is returned. For all other
           existing members, None is returned. If `member' does not appear
           in the archive, KeyError is raised.
        rz'cannot extract (sym)link as file objectN)ryrrrwr_rtr
fileobjectr`rbrrr
extractfile_find_link_target)rrer>s   rDrzTarFile.extractfile6	s	
Cfc"nnV,GG==?gll/A??411
]]_

$,,0""KLL''(>(>w(GHHrFc|jd}|jdtj}tjj|}|r4tjj
|stj||js|jr,|jd|jd|jn|jd|j|jr|j||n|jr|j!||n|j#r|j%||n|j's|j)r|j+||nj|js|jr|j-||n7|j.t0vr|j3||n|j|||rI|j5||||js%|j7|||j9||yyy)z\Extract the TarInfo object tarinfo to a physical
           file called targetpath.
        rWr-z -> N)rrrr[r/rdrBmakedirsr`rbrrrcr_makefileramakedirr-makefifor(r*makedevmakelinkrtrmakeunknownrrr)rr>
targetpathrr	upperdirss      rDrzTarFile._extract_memberV	s &&s+
''RVV4
GGOOJ/	RWW^^I6
KK	"==?gmmoIIaw||W5E5EFGIIa&==?MM':.
]]_LL*-
^^
MM':.
]]_

LL*-
]]_

MM':.
\\
0Wj1MM':.JJw
M:==?

7J/

7J/#rFc	|jtj|ytj|dy#t$rYywxYw)z,Make a directory called targetpath.
        Ni)rrmkdirFileExistsErrorrr>rs   rDrzTarFile.makedir	s?		||#$U+		s!;;	AAc	|j}|j|j|j}t	|d5}|j
d|j
D])\}}|j|t
|||t|+|j|j|jnt
|||jt|dddy#1swYyxYw)z'Make a file called targetpath.
        r;N)
rrr:rIrCr;rrrr1truncate)rr>rsourcerytargetrr1s        rDrzTarFile.makefile	sG''(""
z4
(	NF~~)$+NNJLFDKK'iIJGLL)!FFGLL)WM	N	N	Ns
BCC cf|j|||jdd|jzy)zYMake a file from a TarInfo object with an unknown type
           at targetpath.
        r-z9tarfile: Unknown file type %r, extracted as regular file.N)rrrtrs   rDrzTarFile.makeunknown	s3	


gz*		!24;LLA	BrFcdttdrtj|ytd)z'Make a fifo called targetpath.
        mkfifozfifo not supported by systemN)rrrrrs   rDrzTarFile.makefifo	s&2x IIj!=>>rFcfttdrttdstd|j}|d}|j	r|t
jz}n|t
jz}tj||tj|j|jy)z<Make a character or block device called targetpath.
        mknodrz'special devices not supported by systemNrY)rrrrr*rS_IFBLKS_IFCHRrrrurv)rr>rrs    rDrzTarFile.makedev	sr7#72y+AHII||<D==?DLL DDLL D
TG,,g.>.>?	ArFc:	|jrUtjj|rtj|tj
|j|ytjj|jr!tj|j|y|j|j||y#t$r>	|j|j||Yy#t$r
tddwxYwwxYw)zMake 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.
        z%unable to resolve link inside archiveN)rbrr/lexistsunlinksymlinkrcrBrylinkrrsymlink_exceptionrvrrs   rDrzTarFile.makelink	s
	V}}77??:.IIj)

7++Z877>>'"6"67GGG00*=(()?)?)H)35 	V
V$$T%;%;G%D%/1
V"#JKQUU
V		Vs+A$C'A	C1!C	D!DDDcttdrtjdk(r|j}|j}|sj	t
r.|jr"tj|jd}	tr.|jr"tj|jd}|d}|d}	|jr(ttdrtj|||ytj|||yyy#t$rYwxYw#t$rYuwxYw#t$r}t!d|d}~wwxYw)zSet owner of targetpath according to tarinfo. If numeric_owner
           is True, use .gid/.uid instead of .gname/.uname. If numeric_owner
           is False, fall back to .gid/.uid when the search based on name
           fails.
        geteuidrr.NrHlchownzcould not change owner)rrrr4r3rr6getgrnamrvrr5getpwnamrbrrrr)rr>rrgurs       rDrz
TarFile.chown	s2y!bjjla&7AA w}}LL7:w}}LL7:yy
D==?wr8'<IIj!Q/HHZA./'8! 
 
D"#;<!C
DsB4D84D57D%-D%	DD	D"!D"%	D?.D::D?c|jy	tj||jy#t$r}t	d|d}~wwxYw)zASet file permissions of targetpath according to tarinfo.
        Nzcould not change mode)rrrrr)rr>rrs    rDrz
TarFile.chmod
sF<<	?HHZ.	?67Q>	?s 0	A
AA
c|j}|yttdsy	tj|||fy#t$r}td|d}~wwxYw)zBSet modification time of targetpath according to tarinfo.
        Nrz"could not change modification time)r2rrrrr)rr>rr2rs     rDrz
TarFile.utime
sZ

=r7#	LHHZ%0	LCD!K	Ls;	AAAcL|jd|j|j}d|_|S|j|jj	k7r^|jdk(ry|jj|jdz
|jj
dstdd}		|jj|}	||j0j3||Sd|_|S#t$rU}|jr?|jdd|j|fz|xjtz
c_Yd}~Yd}~d}~wt$rz}|jr?|jdd|j|fz|xjtz
c_Yd}~|jdk(rtt|dYd}~d}~wt $r|jdk(rtd	dY-t"$r/}|jdk(rtt|dYd}~_d}~wt$$r}tt|dd}~wt&$r@}	ddl}t+||j,rtd
|d|#t.$r|wxYwd}~wwxYw)zReturn the next member of the archive as a TarInfo object, when
           TarFile is opened for reading. Return None if there is no more
           available.
        raNrr-rpTr.z0x%X: %sz
empty filezzlib error: )ryrMrrrrrtrr>rrrFrrrYrrrr	ExceptionrrrrrJrrK)rmr>rrs     rDrzTarFile.next
sR
	
D'  A#DH;;$,,++--{{aLLdkkAo.<<$$Q' 899
,,2248<
LL( DLI"
$$IIat{{A.>!>?KK9,K%&
6$$IIat{{A.>!>?KK9,K[[A%#CF+5&#
<;;!##L1t;$'
6;;!##CF+5$(
2A'T1
!!TZZ0',qc(:;E"G
sb<D	J#	AEJ#%AG0$G'J#J#$H66J#IJ#$+JJJJ#c|j}d}|	|j|}|d|}|rtjj|}t
|D]a}|r|j|jk(rd}!|r*tjj|j}n|j}||k(s_|cS|rt|y#t$rd}YwxYw)z}Find an archive member by name from bottom to top.
           If tarinfo is given, it is used as the starting point.
        FNT)	r{indexr<rr/normpathreversedrr)	rrr>	normalizerJskippingrremember_names	         rDruzTarFile._getmemberZ
s
//#
*

g."&5/77##D)Dw'	F>>V]]2$H gg..v{{;$kk{"
	W%%1
  
 sC

CCcV|j	|jd|_y)zWRead through the entire archive file and look for readable
           members.
        NT)rrKrs rDrzz
TarFile._load
s(iik%iik%rFc|jr"td|jjz|'|j|vrtd|jzyy)znCheck if TarFile is still open, and if the operation's mode
           corresponds to TarFile's mode.
        z%s is closedNzbad operation for mode %r)rrr?rr)rrs  rDryzTarFile._check
sS;;.4>>+B+BBCC		 55		ABB!6rFc,|jrQdjtdtjj|j|jf}d}n|j}|}|j||d}|td|z|S)zZFind the target member of a symlink or hardlink member in the
           archive.
        rWNT)r>rzlinkname %r not found)
rbrrrr/rdrrcrurv)rr>rclimitres     rDrzTarFile._find_link_target
s==?xxtbggoogll.KWM]M]-^ _`HE''HE5DI>2X=>>
rFc#RK|jr|jEd{yd}|j|j}|dz
}|	|t	|jkr|j|}n'|js|j}|s	d|_yy|dz
}|Y7w)z$Provide an iterator object.
        Nrr-T)rKrJrMrr>)rrr>s   rD__iter__zTarFile.__iter__
s<<||##'iikGQJEMs4<<((,,u-\\))+#'DLQJEM
$sB'B%BB'cZ||jkrt|tjyy)z.Write debugging output to sys.stderr.
        fileN)rGrrstderr)rlevelmsgs   rDrzTarFile._dbg
s#DJJ#CJJ'rFc&|j|Sr)ryrs rD	__enter__zTarFile.__enter__
s
rFc||jy|js|jjd|_yr)rrrr)rrtr	tracebacks    rD__exit__zTarFile.__exit__
s2<JJL##""$DKrF)
NrNNNNNNrNNNN)rN)rNrY)rNN)NNNTrr).N)rT)TFr")>rrrrrGrErFrHrrbr
rBrCrr>r8rrrr6rsrrRrirmrqrSrrwr{r}rr
rrrrrrrrrrrrrrrrrrrrrrurzryrrrrrrrFrDrrLs
EKLJFH
FGJAEHL>B)-b^#tZ]/]/~22@6:	I%*	?aF$D$L1"1"f%2G.+/%+/ZGG&.+,
C@>B&+*0bN B?A$V2DB?L<B&&PC&>(rFrc	t|dr.|j}t|}|j|nt|}|j	y#t
$rYywxYw)zReturn True if name points to a tar archive that we
       are able to handle, else return False.

       'name' should be a string, file, or file-like object.
    rt)rTF)rrrrrr)rrrs   rDrr
sX
4 ))+CT"AIIcNT
A		sAA	A$#A$c	ddl}d}|j|}|jddddd	|jd
dtd
|j	d}|jdddd|jddddd|jddddd|jdd dd!|j}|jr|j|jd"d#|j|j}t|rut|d$5}|jt|jtj%ddd|j r=td&j#|y|jd"d'j#|yy|j$u|j$}t|r<t&j|d(5}|j%|j )dddy|jd"d'j#|y|j+t)|jd"k(r |jd}t*j,}nHt)|jd*k(r|j\}}n |jd"|j/tr}t&j|d(5}|j1|j+ddd|j rWd,k(rd-j#|}	nd.j#||}	t|	y|jd"d'j#|yy|j2|j2j5d}
t*j6j9|
\}}d/d/d0d0d1d1d1d1d2}
||
vrd3|
|znd4}|j2}t&j|
|5}|D]}|j;|	ddd|j rtd5j#|
yyy#1swYxYw#1swYyxYw#1swYVxYw#1swYXxYw)6Nrz3A simple command-line interface for tarfile module.)descriptionz-vz	--verbose
store_trueFzVerbose output)actiondefaulthelpz--filterz<filtername>zFilter for extraction)metavarchoicesr'T)requiredz-lz--list	<tarfile>zShow listing of a tarfile)r(r'z-ez	--extract+)r+z<output_dir>zExtract tarfile into target dir)nargsr(r'z-cz--create)z<name>z<file>zCreate tarfile from sourcesz-tz--testzTest if a tarfile is validr-z&--filter is only valid for extraction
rrz{!r} is a tar archive.z{!r} is not a tar archive.
rP)rr.)r/rr z{!r} file is extracted.z+{!r} file is extracted into {!r} directory.rrr)rz.tgzz.xzz.txzz.bz2z.tbzz.tbz2z.tb2zw:rz{!r} file created.)argparseArgumentParseradd_argumentradd_mutually_exclusive_group
parse_argsrrexittestrrr{rrrrrbr
rr>rcurdirformat_helprcreater[r/splitextr)r.r#parserrargsrvrtfr5rtar_name_extcompressionstar_mode	tar_files	file_names                 rDmainrC
sGK

$
$
$
=F
k,-/

N .46
///>E	tX{79	t[<=?
tZs39;
tX{8:D{{t||+A@Ayyiic?c3
93 cnn&SZZ8
9||.55c:;KK9@@EF

	iic?c5)
.R-
.
.
KK9@@EF	
	!t||!,,q/CYYF

!
#,,KCKK6--/0c?c5)
?R

6$++
>
?||S=3::3?C2396#v3Fc
KK9@@EF
	 ;;??1%!!(+3
03l/B4,s++KK	
\\(H
-	"&
"	y!
"	"<<&--h78/
!M
9
9
.
.
?
?>	"	"s0:P-P:Q"Q-P7:QQQ__main__r)jrversion
__author____credits__builtinsrrCrrr)rqrrrirrrrrrAttributeErrorNotImplementedErrorrr__all__r?rrsrrrrrr{rr&r$rrrr,CONTTYPErrrrrrrrrrrrrrrrrWrrr
getfilesystemencodingrErLr\rdrnrrrrrrrr	r
rrrrrYrrrobjectrrBufferedReaderr8rrrrrrrjrrrrrrrrrCrrrFrD<module>rPs{:6
H
'
		

	$%8'B*	
^
	











HgGXWg#%5!	#(>+
/

	.
9



77d?H(s((*H0&
(N
<*"&$2	y		8				x		(		(		{		;		[				K	0qqh6<e&eP"2$$"	(	JJ
?k?@{@
LL
?+?=~*	|9f|9~KfKb$$||]9~zFyX
C
Cs"H4I4H?>H?I
I