/snap/core20/2866/usr/lib/python3.8/__pycache__
NameSizeModeActions
abc.cpython-38.pyc53340644editdlrm
aifc.cpython-38.pyc254740644editdlrm
antigravity.cpython-38.pyc7970644editdlrm
argparse.cpython-38.pyc625910644editdlrm
ast.cpython-38.pyc167630644editdlrm
asynchat.cpython-38.pyc68510644editdlrm
asyncore.cpython-38.pyc160280644editdlrm
base64.cpython-38.pyc170710644editdlrm
bdb.cpython-38.pyc249210644editdlrm
binhex.cpython-38.pyc121340644editdlrm
bisect.cpython-38.pyc23540644editdlrm
bz2.cpython-38.pyc114450644editdlrm
calendar.cpython-38.pyc270640644editdlrm
cgi.cpython-38.pyc265440644editdlrm
cgitb.cpython-38.pyc101500644editdlrm
chunk.cpython-38.pyc48390644editdlrm
cmd.cpython-38.pyc126260644editdlrm
code.cpython-38.pyc99130644editdlrm
codecs.cpython-38.pyc339560644editdlrm
codeop.cpython-38.pyc64170644editdlrm
colorsys.cpython-38.pyc32400644editdlrm
compileall.cpython-38.pyc94100644editdlrm
configparser.cpython-38.pyc457180644editdlrm
contextlib.cpython-38.pyc202290644editdlrm
contextvars.cpython-38.pyc2430644editdlrm
copy.cpython-38.pyc69870644editdlrm
copyreg.cpython-38.pyc43180644editdlrm
cProfile.cpython-38.pyc54800644editdlrm
crypt.cpython-38.pyc33870644editdlrm
csv.cpython-38.pyc119100644editdlrm
dataclasses.cpython-38.pyc236530644editdlrm
datetime.cpython-38.pyc571730644editdlrm
decimal.cpython-38.pyc3590644editdlrm
difflib.cpython-38.pyc594380644editdlrm
dis.cpython-38.pyc158080644editdlrm
doctest.cpython-38.pyc759740644editdlrm
dummy_threading.cpython-38.pyc11100644editdlrm
enum.cpython-38.pyc259620644editdlrm
filecmp.cpython-38.pyc84270644editdlrm
fileinput.cpython-38.pyc133730644editdlrm
fnmatch.cpython-38.pyc33550644editdlrm
formatter.cpython-38.pyc175450644editdlrm
fractions.cpython-38.pyc187390644editdlrm
ftplib.cpython-38.pyc280070644editdlrm
functools.cpython-38.pyc279010644editdlrm
genericpath.cpython-38.pyc40010644editdlrm
getopt.cpython-38.pyc62710644editdlrm
getpass.cpython-38.pyc41780644editdlrm
gettext.cpython-38.pyc180000644editdlrm
glob.cpython-38.pyc43430644editdlrm
gzip.cpython-38.pyc181840644editdlrm
hashlib.cpython-38.pyc67270644editdlrm
heapq.cpython-38.pyc140700644editdlrm
hmac.cpython-38.pyc63880644editdlrm
imaplib.cpython-38.pyc413420644editdlrm
imghdr.cpython-38.pyc41180644editdlrm
imp.cpython-38.pyc98090644editdlrm
inspect.cpython-38.pyc805930644editdlrm
io.cpython-38.pyc34540644editdlrm
ipaddress.cpython-38.pyc628290644editdlrm
keyword.cpython-38.pyc9980644editdlrm
linecache.cpython-38.pyc38670644editdlrm
locale.cpython-38.pyc346740644editdlrm
lzma.cpython-38.pyc120180644editdlrm
mailbox.cpython-38.pyc602640644editdlrm
mailcap.cpython-38.pyc72060644editdlrm
mimetypes.cpython-38.pyc160310644editdlrm
modulefinder.cpython-38.pyc161150644editdlrm
netrc.cpython-38.pyc37770644editdlrm
nntplib.cpython-38.pyc339740644editdlrm
ntpath.cpython-38.pyc140910644editdlrm
nturl2path.cpython-38.pyc17440644editdlrm
numbers.cpython-38.pyc122020644editdlrm
opcode.cpython-38.pyc54200644editdlrm
operator.cpython-38.pyc136910644editdlrm
optparse.cpython-38.pyc480570644editdlrm
os.cpython-38.pyc313970644editdlrm
pathlib.cpython-38.pyc442090644editdlrm
pdb.cpython-38.pyc472260644editdlrm
pickle.cpython-38.pyc469080644editdlrm
pickletools.cpython-38.pyc672040644editdlrm
pipes.cpython-38.pyc77950644editdlrm
pkgutil.cpython-38.pyc163090644editdlrm
platform.cpython-38.pyc243260644editdlrm
plistlib.cpython-38.pyc273740644editdlrm
poplib.cpython-38.pyc134590644editdlrm
posixpath.cpython-38.pyc104610644editdlrm
pprint.cpython-38.pyc162810644editdlrm
profile.cpython-38.pyc147580644editdlrm
pstats.cpython-38.pyc220660644editdlrm
pty.cpython-38.pyc39550644editdlrm
pyclbr.cpython-38.pyc104510644editdlrm
pydoc.cpython-38.pyc836460644editdlrm
py_compile.cpython-38.pyc73520644editdlrm
queue.cpython-38.pyc106260644editdlrm
quopri.cpython-38.pyc57480644editdlrm
random.cpython-38.pyc201080644editdlrm
re.cpython-38.pyc144220644editdlrm
reprlib.cpython-38.pyc53030644editdlrm
rlcompleter.cpython-38.pyc57550644editdlrm
runpy.cpython-38.pyc81810644editdlrm
sched.cpython-38.pyc65320644editdlrm
secrets.cpython-38.pyc21900644editdlrm
selectors.cpython-38.pyc169350644editdlrm
shelve.cpython-38.pyc94900644editdlrm
shlex.cpython-38.pyc75360644editdlrm
shutil.cpython-38.pyc372190644editdlrm
signal.cpython-38.pyc28430644editdlrm
site.cpython-38.pyc171680644editdlrm
sitecustomize.cpython-38.pyc2200644editdlrm
smtpd.cpython-38.pyc264630644editdlrm
smtplib.cpython-38.pyc355320644editdlrm
sndhdr.cpython-38.pyc69890644editdlrm
socket.cpython-38.pyc277870644editdlrm
socketserver.cpython-38.pyc253610644editdlrm
sre_compile.cpython-38.pyc151420644editdlrm
sre_constants.cpython-38.pyc63590644editdlrm
sre_parse.cpython-38.pyc216470644editdlrm
ssl.cpython-38.pyc450370644editdlrm
stat.cpython-38.pyc43720644editdlrm
statistics.cpython-38.pyc336530644editdlrm
string.cpython-38.pyc73000644editdlrm
stringprep.cpython-38.pyc110170644editdlrm
struct.cpython-38.pyc3300644editdlrm
subprocess.cpython-38.pyc419670644editdlrm
sunau.cpython-38.pyc170800644editdlrm
symbol.cpython-38.pyc24040644editdlrm
symtable.cpython-38.pyc113220644editdlrm
sysconfig.cpython-38.pyc158370644editdlrm
tabnanny.cpython-38.pyc70300644editdlrm
tarfile.cpython-38.pyc630430644editdlrm
telnetlib.cpython-38.pyc182370644editdlrm
tempfile.cpython-38.pyc266530644editdlrm
textwrap.cpython-38.pyc135190644editdlrm
this.cpython-38.pyc12610644editdlrm
threading.cpython-38.pyc399760644editdlrm
timeit.cpython-38.pyc117770644editdlrm
token.cpython-38.pyc24850644editdlrm
tokenize.cpython-38.pyc171600644editdlrm
trace.cpython-38.pyc200260644editdlrm
traceback.cpython-38.pyc199380644editdlrm
tracemalloc.cpython-38.pyc173630644editdlrm
tty.cpython-38.pyc10760644editdlrm
turtle.cpython-38.pyc1300220644editdlrm
types.cpython-38.pyc91770644editdlrm
typing.cpython-38.pyc624200644editdlrm
uu.cpython-38.pyc36050644editdlrm
uuid.cpython-38.pyc236830644editdlrm
warnings.cpython-38.pyc136520644editdlrm
wave.cpython-38.pyc181490644editdlrm
weakref.cpython-38.pyc195180644editdlrm
webbrowser.cpython-38.pyc171200644editdlrm
xdrlib.cpython-38.pyc82210644editdlrm
zipapp.cpython-38.pyc58540644editdlrm
zipfile.cpython-38.pyc593360644editdlrm
zipimport.cpython-38.pyc172750644editdlrm
_bootlocale.cpython-38.pyc12430644editdlrm
_collections_abc.cpython-38.pyc287410644editdlrm
_compat_pickle.cpython-38.pyc55010644editdlrm
_compression.cpython-38.pyc41460644editdlrm
_dummy_thread.cpython-38.pyc60370644editdlrm
_markupbase.cpython-38.pyc77900644editdlrm
_osx_support.cpython-38.pyc115930644editdlrm
_pydecimal.cpython-38.pyc1607350644editdlrm
_pyio.cpython-38.pyc740790644editdlrm
_py_abc.cpython-38.pyc46700644editdlrm
_sitebuiltins.cpython-38.pyc34810644editdlrm
_strptime.cpython-38.pyc160440644editdlrm
_sysconfigdata__linux_x86_64-linux-gnu.cpython-38.pyc211210644editdlrm
_sysconfigdata__x86_64-linux-gnu.cpython-38.pyc211150644editdlrm
_threading_local.cpython-38.pyc64460644editdlrm
_weakrefset.cpython-38.pyc76000644editdlrm
__future__.cpython-38.pyc41580644editdlrm
__phello__.foo.cpython-38.pyc1270644editdlrm
Edit: /snap/core20/2866/usr/lib/python3.8/__pycache__/tarfile.cpython-38.pyc (63043B)
U ¼Ê¦i\uã@stdZdZdZdZddlmZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlZddlZz ddlZWnek rˆdZYnXz ddlZWnek r®dZYnXeefZzeef7ZWnek rÚYnXddd d d d d ddddddddgZdZdZedZdZdZdZdZdZ dZ!dZ"dZ#dZ$d Z%d!Z&d"Z'd#Z(d$Z)d%Z*d&Z+d'Z,d(Z-d)Z.d*Z/dZ0d+Z1d,Z2e2Z3e!e"e#e$e'e(e)e%e&e*e+e,f Z4e!e"e)e,fZ5e*e+e,fZ6d-Z7d.d/d0d1hZ8e9e9e9e:e:e:d2œZ;ej¡Z=d5d6„Z?d7d8„Z@d9d:„ZAd;e3fdd?„ZCdedfd@dA„ZDdBdC„ZEGdDd „d eFƒZGGdEd„deGƒZHGdFd „d eGƒZIGdGd „d eGƒZJGdHd „d eGƒZKGdId„deGƒZLGdJdK„dKeLƒZMGdLdM„dMeLƒZNGdNdO„dOeLƒZOGdPdQ„dQeLƒZPGdRdS„dSeLƒZQGdTdU„dUƒZRGdVdW„dWƒZSGdXdY„dYeTƒZUGdZd[„d[eTƒZVGd\d]„d]e jWƒZXe Yd^¡ZZGd_d„deTƒZ[Gd`d„deTƒZ\dad „Z]e\jZdbdc„Z^e_ddkrpe^ƒdS)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ÚTarFileÚTarInfoÚ is_tarfileÚTarErrorÚ ReadErrorÚCompressionErrorÚ StreamErrorÚ ExtractErrorÚ HeaderErrorÚENCODINGÚ USTAR_FORMATÚ GNU_FORMATÚ PAX_FORMATÚDEFAULT_FORMATróiésustar sustar00édé›ó0ó1ó2ó3ó4ó5ó6ó7óLóKóSóxógóXéé)ÚpathÚlinkpathÚsizeÚmtimeÚuidÚgidÚunameÚgnamer%r&r+r,)ZatimeÚctimer(r)r*r'Úntúutf-8cCs(| ||¡}|d|…|t|ƒtS)z8Convert a string to a null-terminated bytes object. N)ÚencodeÚlenÚNUL)ÚsÚlengthÚencodingÚerrors©r7ú/usr/lib/python3.8/tarfile.pyÚstnžs r9cCs*| d¡}|dkr|d|…}| ||¡S)z8Convert a null-terminated bytes object to a string. réÿÿÿÿN)ÚfindÚdecode)r3r5r6Úpr7r7r8Únts¤s  r>cCs¦|ddkrbd}tt|ƒdƒD]}|dK}|||d7}q |ddkr¢dt|ƒd| }n@z"t|ddƒ}t| ¡p|d dƒ}Wntk r td ƒ‚YnX|S) z/Convert a number field to a python number. r)é€éÿr#ér@éÚasciiÚstrictÚ0úinvalid header)Úranger1r>ÚintÚstripÚ ValueErrorÚInvalidHeaderError)r3ÚnÚir7r7r8Únti¬s   rNrAcCsØt|ƒ}d|kr$d|dkrDnntd|d|fdƒt}n|tkrÌd|d |krrd|dkrÌnnV|dkrŠtdgƒ}ntdgƒ}d||}t|dƒD]}| d|d@¡|dL}q¬ntd ƒ‚|S) z/Convert a python number to a number field. rrAr#z%0*orCrBr?r@zoverflow in number field)rHÚbytesr2rÚ bytearrayrGÚinsertrJ)rLÚdigitsÚformatr3rMr7r7r8ÚitnÀs  2    rTcCs0dtt d|¡ƒ}dtt d|¡ƒ}||fS)a¨Calculate 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. rBZ 148B8x356BZ 148b8x356b)ÚsumÚstructZ unpack_from)ÚbufZunsigned_chksumZ signed_chksumr7r7r8Ú calc_chksumsÝs rXc Cs¦|pd}|dkrdS|dkr.t |||¡dSt||ƒ\}}t|ƒD],}| |¡}t|ƒ|krf|dƒ‚| |¡qD|dkr¢| |¡}t|ƒ|kr˜|dƒ‚| |¡dS)zjCopy length bytes from fileobj src to fileobj dst. If length is None, copy the entire content. i@rNúunexpected end of data)ÚshutilÚ copyfileobjÚdivmodrGÚreadr1Úwrite) ÚsrcZdstr4Ú exceptionÚbufsizeÚblocksÚ remainderÚbrWr7r7r8r[ês$       r[cCs8ttjddƒ}|dk r(| |d¡ |¡}t|dddS)Nr5Úbackslashreplaceú )Úend)ÚgetattrÚsysÚstdoutr0r<Úprint)r3r5r7r7r8Ú _safe_printsrlc@seZdZdZdS)rzBase exception.N©Ú__name__Ú __module__Ú __qualname__Ú__doc__r7r7r7r8r sc@seZdZdZdS)r z%General exception for extract errors.Nrmr7r7r7r8r sc@seZdZdZdS)rz&Exception for unreadable tar archives.Nrmr7r7r7r8rsc@seZdZdZdS)rz.Exception for unavailable compression methods.Nrmr7r7r7r8rsc@seZdZdZdS)r z=Exception for unsupported operations on stream-like TarFiles.Nrmr7r7r7r8r sc@seZdZdZdS)r z!Base exception for header errors.Nrmr7r7r7r8r sc@seZdZdZdS)ÚEmptyHeaderErrorzException for empty headers.Nrmr7r7r7r8rrsrrc@seZdZdZdS)ÚTruncatedHeaderErrorz Exception for truncated headers.Nrmr7r7r7r8rssrsc@seZdZdZdS)ÚEOFHeaderErrorz"Exception for end of file headers.Nrmr7r7r7r8rt"srtc@seZdZdZdS)rKzException for invalid headers.Nrmr7r7r7r8rK%srKc@seZdZdZdS)ÚSubsequentHeaderErrorz3Exception for missing and invalid extended headers.Nrmr7r7r7r8ru(sruc@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) Ú _LowLevelFilez‰Low-level file object. Supports reading and writing. It is used instead of a regular file object for streaming access. cCsFtjtjtjBtjBdœ|}ttdƒr2|tjO}t ||d¡|_dS)N©ÚrÚwÚO_BINARYi¶) ÚosÚO_RDONLYÚO_WRONLYÚO_CREATÚO_TRUNCÚhasattrrzrÚfd)ÚselfÚnameÚmoder7r7r8Ú__init__5sþý  z_LowLevelFile.__init__cCst |j¡dS©N)r{Úcloser©r‚r7r7r8r‡>sz_LowLevelFile.closecCst |j|¡Sr†)r{r]r©r‚r'r7r7r8r]Asz_LowLevelFile.readcCst |j|¡dSr†)r{r^r©r‚r3r7r7r8r^Dsz_LowLevelFile.writeN)rnrorprqr…r‡r]r^r7r7r7r8rv/s  rvc@sreZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z ddd„Z dd„Z dd„Zdd„ZdS)Ú_Streama˜Class 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. c Csäd|_|dkrt||ƒ}d|_|dkr6t|ƒ}| ¡}|psz_StreamProxy.__init__cCs|jj|_|jSr†)ršr]rWr‰r7r7r8r]Bs z_StreamProxy.readcCsP|j d¡rdS|jdd…dkr8|jdd…dkr8d S|j d ¡rHd Sd SdS) Ns‹rrésBZhrºé s1AY&SYr)s]€sý7zXZr’r”)rWÚ startswithrˆr7r7r8r˜Fs $ z_StreamProxy.getcomptypecCs|j ¡dSr†)ršr‡rˆr7r7r8r‡Psz_StreamProxy.closeN)rnrorprqr…r]r˜r‡r7r7r7r8r—9s  r—c@sjeZdZdZddd„Zdd„Zdd„Zd d „Zd d „Zd d„Z e j fdd„Z ddd„Z dd„Zdd„ZdS)Ú _FileInFilezA thin wrapper around an existing file object that provides a part of its data as an individual file object. NcCsÊ||_||_||_d|_t|ddƒ|_d|_|dkr>d|fg}d|_g|_d}|j}|D]L\}}||kr||j  d||df¡|j  d||||f¡||7}||}qX||jkrÆ|j  d||jdf¡dS)NrrƒFT) ršÚoffsetr'ÚpositionrhrƒrœÚ map_indexÚmaprÄ)r‚ršrÎr'Z blockinfoZlastposZrealposr7r7r8r…]s(    z_FileInFile.__init__cCsdSr†r7rˆr7r7r8r¶vsz_FileInFile.flushcCsdS©NTr7rˆr7r7r8Úreadableysz_FileInFile.readablecCsdS)NFr7rˆr7r7r8Úwritable|sz_FileInFile.writablecCs |j ¡Sr†)ršÚseekablerˆr7r7r8rÕsz_FileInFile.seekablecCs|jS)z*Return the current file position. )rÏrˆr7r7r8r¿‚sz_FileInFile.tellcCs|tjkr tt|dƒ|jƒ|_nj|tjkr\|dkrFt|j|dƒ|_qŠt|j||jƒ|_n.|tjkr‚tt|j||jƒdƒ|_ntdƒ‚|jS)z(Seek to a position in the file. rzInvalid argument) ÚioÚSEEK_SETÚminÚmaxr'rÏÚSEEK_CURÚSEEK_ENDrJ)r‚rÏÚwhencer7r7r8rÀ‡s   z_FileInFile.seekc Cs |dkr|j|j}nt||j|jƒ}d}|dkr|j|j\}}}}||jkr`|krhqŽnqŽq6|jd7_|jt|jƒkr6d|_q6t|||jƒ}|râ|j ||j|¡|j |¡}t|ƒ|krØt dƒ‚||7}n |t |7}||8}|j|7_q,|S)z!Read data from the file. NrŽrr#rY) r'rÏrØrÑrÐr1ršrÀr]rr2) r‚r'rWÚdataÚstartÚstoprÎr4rdr7r7r8r]—s,     z_FileInFile.readcCs&| t|ƒ¡}||dt|ƒ…<t|ƒSr†)r]r1)r‚rdrWr7r7r8Úreadinto¶sz_FileInFile.readintocCs d|_dSrÒ)rœrˆr7r7r8r‡»sz_FileInFile.close)N)N)rnrorprqr…r¶rÓrÔrÕr¿rÖr×rÀr]ràr‡r7r7r7r8rÍWs  rÍcseZdZ‡fdd„Z‡ZS)Ú ExFileObjectcs&t|j|j|j|jƒ}tƒ |¡dSr†)rÍršÚ offset_datar'ÚsparseÚsuperr…)r‚ÚtarfileÚtarinforš©Ú __class__r7r8r…Ás  ÿzExFileObject.__init__)rnrorpr…Ú __classcell__r7r7rçr8rá¿srás([0-9]{1,20}) c@sºeZdZdZedddddddd d d d d dddddddddZdedd„Zedd„ƒZej dd„ƒZedd„ƒZ e j dd„ƒZ dd„Z d d!„Z e ed"fd#d$„Zd%d&„Zd'd(„Zd)d*„Zed+d,„ƒZd-d.„Zed/d0„ƒZed1d2„ƒZed3d4„ƒZed5d6„ƒZed7d8„ƒZed9d:„ƒZd;d<„Zd=d>„Zd?d@„ZdAdB„Z dCdD„Z!dEdF„Z"dGdH„Z#dIdJ„Z$dKdL„Z%dMdN„Z&dOdP„Z'dQdR„Z(dSdT„Z)dUdV„Z*dWdX„Z+dYdZ„Z,d[d\„Z-d]d^„Z.d_d`„Z/dadb„Z0dcdd„Z1dS)fraInformational 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. zName of the archive member.zPermission bits.z6User ID of the user who originally stored this member.z7Group ID of the user who originally stored this member.zSize in bytes.zTime of last modification.zHeader checksum.z–File type. type is usually one of these constants: REGTYPE, AREGTYPE, LNKTYPE, SYMTYPE, DIRTYPE, FIFOTYPE, CONTTYPE, CHRTYPE, BLKTYPE, GNUTYPE_SPARSE.zcName of the target file name, which is only present in TarInfo objects of type LNKTYPE and SYMTYPE.z User name.z Group name.zDevice major number.zDevice minor number.zThe tar header starts here.zThe file's data starts here.zMA dictionary containing key-value pairs of an associated pax extended header.zSparse member information.N)rƒr„r)r*r'r(ÚchksumÚtypeÚlinknamer+r,ÚdevmajorÚdevminorrÎrâÚ pax_headersrãråÚ_sparse_structsÚ _link_targetrcCsj||_d|_d|_d|_d|_d|_d|_t|_d|_ d|_ d|_ d|_ d|_ d|_d|_d|_i|_dS)zXConstruct a TarInfo object. name is the optional name of the member. i¤rrN)rƒr„r)r*r'r(rêÚREGTYPErërìr+r,rírîrÎrârãrï©r‚rƒr7r7r8r…ñs"zTarInfo.__init__cCs|jS)z(In pax headers, "name" is called "path".©rƒrˆr7r7r8r% sz TarInfo.pathcCs ||_dSr†rôrór7r7r8r%scCs|jS)z0In pax headers, "linkname" is called "linkpath".©rìrˆr7r7r8r&szTarInfo.linkpathcCs ||_dSr†rõ)r‚rìr7r7r8r&scCsd|jj|jt|ƒfS)Nz<%s %r at %#x>)rèrnrƒÚidrˆr7r7r8Ú__repr__szTarInfo.__repr__cCsl|j|jd@|j|j|j|j|j|j|j|j |j |j |j dœ }|dt krh|d d¡sh|dd7<|S)z9Return the TarInfo's attributes as a dictionary. éÿ) rƒr„r)r*r'r(rêrërìr+r,rírîrërƒú/)rƒr„r)r*r'r(rêrërìr+r,rírîÚDIRTYPEr³)r‚Úinfor7r7r8Úget_infos"ózTarInfo.get_infoÚsurrogateescapecCsT| ¡}|tkr| |||¡S|tkr4| |||¡S|tkrH| ||¡Stdƒ‚dS)zq*z|| dd ¡Wn$tk rv||||<Yq*YnXt||ƒ|kr*||||<q*d D]`\}}||kr´d ||<qš||}d |krØd |d krænn t|t ƒršt |ƒ||<d ||<qš|r|  |t |¡} nd} | |  |tdd¡S)z³Return the object as a ustar header block. If it cannot be represented this way, prepend a pax extended header sequence with supplement information. rrƒr%rìr&)r+r+é )r,r,r rCrD))r)rA)r*rA)r'é )r(rrrAr#rŽr®)rrïÚcopyrrr0ÚUnicodeEncodeErrorr1Ú isinstanceÚfloatÚstrÚ_create_pax_generic_headerÚXHDTYPErr ) r‚rûr5rïrƒZhnamer4rRÚvalrWr7r7r8r_s8 þ   *  zTarInfo.create_pax_headercCs| |td¡S)zAReturn the object as a pax global header block sequence. r/)rÚXGLTYPE)Úclsrïr7r7r8Úcreate_pax_global_headersz TarInfo.create_pax_global_headercCs~| d¡}tdt|ƒƒD]T}d |d|…¡}d ||d…¡}t| ||¡ƒtkrt| ||¡ƒtkrqvqtdƒ‚||fS)zUSplit a name longer than 100 chars into a prefix and a name part. rùr#Nzname is too long)ÚsplitrGr1rÅr0Ú LENGTH_PREFIXrrJ)r‚rƒr5r6Z componentsrMrr7r7r8r–s ÿzTarInfo._posix_split_namecCsVt| dd¡d||ƒt| dd¡d@d|ƒt| dd¡d|ƒt| d d¡d|ƒt| d d¡d |ƒt| d d¡d |ƒd | dt¡t| dd¡d||ƒ| dt¡t| dd¡d||ƒt| dd¡d||ƒt| dd¡d|ƒt| dd¡d|ƒt| dd¡d||ƒg}t dtd |¡¡}t |t d…ƒd}|dd…t d|dƒ|dd…}|S)z„Return a header block. info is a dictionary with file information, format must be one of the *_FORMAT constants. rƒrrr„rrørAr)r*r'rr(s rërìrr+r r,rírîrrz%dsrŽNi”þÿÿz%06orCi›þÿÿ) r9ÚgetrTròrrVr°rÉrÅrXrO)rûrSr5r6ÚpartsrWrêr7r7r8r¦s(  ñ&zTarInfo._create_headercCs.tt|ƒtƒ\}}|dkr*|t|t7}|S)zdReturn the string payload filled with zero bytes up to the next 512 byte border. r)r\r1rÉr2)Zpayloadrbrcr7r7r8Ú_create_payloadÂszTarInfo._create_payloadcCsR| ||¡t}i}d|d<||d<t|ƒ|d<t|d<| |t||¡| |¡S)zTReturn a GNUTYPE_LONGNAME or GNUTYPE_LONGLINK sequence for name. z ././@LongLinkrƒrër'r)r0r2r1r rr r)rrƒrër5r6rûr7r7r8r Ìs ÿzTarInfo._create_gnu_long_headerc Cs2d}| ¡D]8\}}z| dd¡Wq tk rBd}YqFYq Xq d}|rV|d7}| ¡D]\}}| d¡}|r‚| |d¡}n | d¡}t|ƒt|ƒd}d } } |tt| ƒƒ} | | krÂqÈ| } q¨|tt| ƒd ƒd |d |d 7}q^i} d| d<|| d<t|ƒ| d<t| d<| | td d¡|  |¡S)z¡Return a POSIX.1-2008 extended or global header sequence that contains a list of keyword, value pairs. The values must be strings. Fr/rDTrŽs21 hdrcharset=BINARY rýrÊrrCó ó=ó z././@PaxHeaderrƒrër'rr®) Úitemsr0rr1rrOrrr r) rrïrër5ZbinaryÚkeywordÚvalueZrecordsÚlrLr=rûr7r7r8rÝs<  ( ÿz"TarInfo._create_pax_generic_headerc Csvt|ƒdkrtdƒ‚t|ƒtkr(tdƒ‚| t¡tkr>tdƒ‚t|dd…ƒ}|t|ƒkrbt dƒ‚|ƒ}t |dd…||ƒ|_ t|dd …ƒ|_ t|d d …ƒ|_ t|d d …ƒ|_t|d d …ƒ|_t|d d…ƒ|_||_|dd …|_t |d d…||ƒ|_t |dd…||ƒ|_t |dd…||ƒ|_t|dd…ƒ|_t|dd…ƒ|_t |dd…||ƒ}|jtkr†|j  d¡r†t|_|jtkr8d}g}tdƒD]l} z0t|||d…ƒ} t||d|d…ƒ} Wntk rôYqYnX| | | f¡|d7}q¢t|dƒ} t|dd…ƒ} || | f|_ | !¡rP|j  "d¡|_ |rr|jt#krr|d|j |_ |S)zAConstruct a TarInfo object from a 512 byte bytes object. rz empty headerztruncated headerzend of file headeré”éœz bad checksumrélété|éˆéii i)iIiQiYiôrùi‚rºréiâiãiï)$r1rrrÉrsÚcountr2rtrNrXrKr>rƒr„r)r*r'r(rêrërìr+r,rírîÚAREGTYPEr³rúÚGNUTYPE_SPARSErGrJrÄÚboolrðÚisdirÚrstripÚ GNU_TYPES)rrWr5r6rêÚobjrr›ÚstructsrMrÎÚnumbytesÚ isextendedÚorigsizer7r7r8ÚfrombufsZ         zTarInfo.frombufcCs8|j t¡}| ||j|j¡}|j ¡t|_| |¡S)zOReturn the next TarInfo object from TarFile object tarfile. ) ršr]rÉr:r5r6r¿rÎÚ _proc_member)rrårWr5r7r7r8Ú fromtarfileOs zTarInfo.fromtarfilecCsT|jttfkr| |¡S|jtkr,| |¡S|jtttfkrF|  |¡S|  |¡SdS)zYChoose the right processing method depending on the type and call it. N) rër r Ú _proc_gnulongr0Ú _proc_sparserrÚSOLARIS_XHDTYPEÚ _proc_paxÚ _proc_builtin)r‚rår7r7r8r;ds    zTarInfo._proc_membercCsR|j ¡|_|j}| ¡s$|jtkr4|| |j¡7}||_|  |j |j |j ¡|S)zfProcess a builtin type or an unknown type which will be treated as a regular file. ) ršr¿râÚisregrëÚSUPPORTED_TYPESÚ_blockr'rÎÚ_apply_pax_inforïr5r6)r‚rårÎr7r7r8rAqs zTarInfo._proc_builtincCs†|j | |j¡¡}z| |¡}Wntk r>tdƒ‚YnX|j|_|jt krft ||j |j ƒ|_ n|jtkr‚t ||j |j ƒ|_|S)zSProcess the blocks that hold a GNU longname or longlink member. ú missing or bad subsequent header)ršr]rDr'r<r rurÎrër r>r5r6rƒr rì)r‚rårWÚnextr7r7r8r=‚s  zTarInfo._proc_gnulongc CsÚ|j\}}}|`|rª|j t¡}d}tdƒD]n}z0t|||d…ƒ}t||d|d…ƒ} Wntk rzYqœYnX|r’| r’| || f¡|d7}q,t|dƒ}q||_ |j  ¡|_ |j |  |j ¡|_||_ |S)z8Process a GNU sparse header plus extra headers. rérr-iø)rðršr]rÉrGrNrJrÄr1rãr¿rârDr'rÎ) r‚rår6r8r9rWr›rMrÎr7r7r7r8r>˜s(      zTarInfo._proc_sparsecCsÌ|j | |j¡¡}|jtkr&|j}n |j ¡}d}d}g}t|ƒ|krj||dkrjt   ||¡}spt dƒ‚zt |  d¡ƒ}Wntk ržt dƒ‚YnX|dkr°t dƒ‚||t|ƒkrÈt dƒ‚| d¡|d} || d¡d| …} |  d¡\} } } | r| dks|| dkr&t dƒ‚| || | f¡| dkr`|dkr`| d kr\|j}nd }||7}q<|dkrxd }|D]X\}} } | | d d |j¡}|tkr¸| | ||j|j¡}n| | d d |j¡}|||<q|z| |¡}Wntk rtd ƒ‚YnXd |kr| ||¡nFd |kr4| ||¡n.| d¡dkrb| d¡dkrb| |||¡|jttfkrÈ|  ||j|j¡|j!|_!d|krÈ|j"}| #¡s²|jt$krÂ|| |j¡7}||_!|S)zVProcess an extended or global header as described in POSIX.1-2008. rNrFr#ér rËs hdrcharsetsBINARYr/rFúGNU.sparse.mapúGNU.sparse.sizezGNU.sparse.majorÚ1zGNU.sparse.minorrEr')%ršr]rDr'rërrïrr1Ú_header_length_prefix_reÚmatchrKrHÚgrouprJrÞrgÚ partitionrÄr5Ú_decode_pax_fieldr6ÚPAX_NAME_FIELDSr<r ruÚ_proc_gnusparse_01Ú_proc_gnusparse_00rÚ_proc_gnusparse_10rr?rErÎrârBrC)r‚rårWrïr›r5Ú raw_headersrNr4Zheader_value_end_offsetZkeyword_and_valueZ raw_keywordZequalsZ raw_valuer#r$rGrÎr7r7r8r@´s|       ÿ  ÿ ÿ     zTarInfo._proc_paxc Cs¦g}g}|D]„\}}}|dkrTz| t| ¡ƒ¡Wqtk rPtdƒ‚YqXq |dkr z| t| ¡ƒ¡Wq tk rŽtdƒ‚Yq Xq tt||ƒƒ|_dS)z?Process a GNU tar extended sparse header, version 0.0. sGNU.sparse.offsetrFsGNU.sparse.numbytesN)rÄrHr<rJrKÚlistÚziprã)r‚rGrVZoffsetsr7Ú_r#r$r7r7r8rT-szTarInfo._proc_gnusparse_00cCs@dd„|d d¡Dƒ}tt|ddd…|ddd…ƒƒ|_dS)z?Process a GNU tar extended sparse header, version 0.1. cSsg|] }t|ƒ‘qSr7)rH)Ú.0Úxr7r7r8Ú Dsz.TarInfo._proc_gnusparse_01..rJú,Nr$r#)rrWrXrã)r‚rGrïrãr7r7r8rSAszTarInfo._proc_gnusparse_01cCs¨d}g}|j t¡}| dd¡\}}t|ƒ}t|ƒ|dkrtd|krT||j t¡7}| dd¡\}}| t|ƒ¡q,|j ¡|_t t |ddd…|ddd…ƒƒ|_ dS)z?Process a GNU tar extended sparse header, version 1.0. Nr!r#r$) ršr]rÉrrHr1rÄr¿rârWrXrã)r‚rGrïråZfieldsrãrWZnumberr7r7r8rUGs  zTarInfo._proc_gnusparse_10c CsÂ| ¡D]ª\}}|dkr&t|d|ƒq|dkr@t|dt|ƒƒq|dkrZt|dt|ƒƒq|tkr|tkr”zt||ƒ}Wntk r’d}YnX|dkr¦| d¡}t|||ƒq| ¡|_dS) zoReplace fields with supplemental information from a previous pax extended or global header. zGNU.sparse.namer%rKr'zGNU.sparse.realsizerrùN) r"ÚsetattrrHÚ PAX_FIELDSÚPAX_NUMBER_FIELDSrJr3rrï)r‚rïr5r6r#r$r7r7r8rEWs"  zTarInfo._apply_pax_infocCs4z| |d¡WStk r.| ||¡YSXdS)z1Decode a single field from a pax record. rDN)r<ÚUnicodeDecodeError)r‚r$r5Zfallback_encodingZfallback_errorsr7r7r8rQnszTarInfo._decode_pax_fieldcCs2|dkrtdƒ‚t|tƒ\}}|r*|d7}|tS)z_Round up a byte count by BLOCKSIZE and return it, e.g. _block(834) => 1024. rzinvalid offsetr#)rKr\rÉ)r‚r.rbrcr7r7r8rDvs zTarInfo._blockcCs |jtkS©z4Return True if the Tarinfo object is a regular file.)rëÚ REGULAR_TYPESrˆr7r7r8rB‚sz TarInfo.isregcCs| ¡Srb)rBrˆr7r7r8Úisfile†szTarInfo.isfilecCs |jtkS)z!Return True if it is a directory.)rërúrˆr7r7r8r2Šsz TarInfo.isdircCs |jtkS)z%Return True if it is a symbolic link.)rëÚSYMTYPErˆr7r7r8ÚissymŽsz TarInfo.issymcCs |jtkS)z!Return True if it is a hard link.)rëÚLNKTYPErˆr7r7r8Úislnk’sz TarInfo.islnkcCs |jtkS)z(Return True if it is a character device.)rëÚCHRTYPErˆr7r7r8Úischr–sz TarInfo.ischrcCs |jtkS)z$Return True if it is a block device.)rëÚBLKTYPErˆr7r7r8Úisblkšsz TarInfo.isblkcCs |jtkS)zReturn True if it is a FIFO.)rëÚFIFOTYPErˆr7r7r8ÚisfifožszTarInfo.isfifocCs |jdk Sr†)rãrˆr7r7r8Úissparse¢szTarInfo.issparsecCs|jtttfkS)zCReturn True if it is one of character device, block device or FIFO.)rërirkrmrˆr7r7r8Úisdev¥sz TarInfo.isdev)r)2rnrorprqÚdictÚ __slots__r…Úpropertyr%Úsetterr&r÷rürr rrþrÿrÚ classmethodrrÚ staticmethodrrr rr:r<r;rAr=r>r@rTrSrUrErQrDrBrdr2rfrhrjrlrnrorpr7r7r7r8rÎs”è      1     2 >  y c @s´eZdZdZdZdZdZdZeZ e Z dZ e ZeZd\dd „Zedddefd d „ƒZed]d d „ƒZed^dd„ƒZed_dd„ƒZed`dd„ƒZdddddœZdd„Zdd„Zdd„Zd d!„Zdad"d#„Zdbdd%œd&d'„Zdcdd(œd)d*„Z ddd+d,„Z!dedd.œd/d0„Z"dfdd.œd2d3„Z#d4d5„Z$dgd6d7„Z%d8d9„Z&d:d;„Z'dd?„Z)d@dA„Z*dBdC„Z+dDdE„Z,dFdG„Z-dHdI„Z.dJdK„Z/dhdLdM„Z0dNdO„Z1didPdQ„Z2dRdS„Z3dTdU„Z4dVdW„Z5dXdY„Z6dZd[„Z7dS)jrz=The TarFile Class provides an interface to tar archives. rFr#Nrxrýc Csªdddddœ}||krtdƒ‚||_|||_|sh|jdkrTtj |¡sTd|_d|_t||jƒ}d |_n@|d krt|d ƒrt |j t t fƒr|j }t|d ƒr¢|j|_d |_|r¸tj  |¡nd |_ ||_|d k rÒ||_|d k rà||_|d k rî||_|d k rü||_|d k r ||_| |_| d k r0|jtkr0| |_ni|_| d k rF| |_| d k rV| |_| |_d |_g|_d |_|j ¡|_i|_zþ|jdkržd |_ | !¡|_ |jdkr2|j "|j¡z|j #|¡}|j $|¡WnXt%k rþ|j "|j¡Yq2Yn0t&k r,}zt't |ƒƒ‚W5d }~XYnXqª|jdkr|d |_|jr||j (|j )¡¡}|j *|¡|jt+|ƒ7_Wn&|js˜|j ,¡d |_‚YnXd S)aÖOpen 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+bÚwbZxb©rxÚaryr[ú!mode must be 'r', 'a', 'w' or 'x'rzryFNrƒr„Trx©rzryr[)-rJr„Ú_moder{r%ÚexistsÚ bltn_openr–r€rrƒrrOÚabspathršrSræÚ dereferenceÚ ignore_zerosr5r6rrïÚdebugÚ errorlevelÚ copybufsizerœÚmembersÚ_loadedr¿rÎÚinodesÚ firstmemberrGrÀr<rÄrtr rrrr^r1r‡)r‚rƒr„ršrSrærr‚r5r6rïrƒr„r…ZmodesÚerWr7r7r8r…ÄsŠ   ÿ          "   zTarFile.__init__c sº|s|stdƒ‚|dkrª‡fdd„}tˆj|dD]j}tˆˆj|ƒ}|dk rV| ¡} z||d|f|ŽWSttfk rš|dk r’| | ¡Yq2Yq2Xq2tdƒ‚nd |kr | d d ¡\} }| pÊd} |pÒd }|ˆjkrðtˆˆj|ƒ}n td |ƒ‚||| |f|ŽSd |kr’| d d ¡\} }| p.d} |p8d }| dkrLtdƒ‚t || |||ƒ} zˆ|| | f|Ž} Wn|   ¡‚YnXd| _ | S|dkr®ˆj |||f|ŽStdƒ‚dS)a¥Open 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)rxúr:*csˆj|dkS)NÚtaropen)Ú OPEN_METH)r™©rr7r8Únot_compressed]sz$TarFile.open..not_compressed©ÚkeyNrxz%file could not be opened successfullyú:r#r”r•ú|rwzmode must be 'r' or 'w'Fr|zundiscernible mode) rJÚsortedrrhr¿rrrÀrr‹r‡r–rŒ) rrƒr„ršraÚkwargsrr™ÚfuncZ saved_posÚfilemodeÚstreamrÈr7rŽr8r3sP%            z TarFile.opencKs |dkrtdƒ‚||||f|ŽS)zCOpen uncompressed tar archive name for reading or writing. ryr{)rJ)rrƒr„ršr•r7r7r8rŒŽszTarFile.taropenrªcKsè|dkrtdƒ‚zddlm}Wntk r<tdƒ‚YnXz|||d||ƒ}Wn.tk r‚|dk r||dkr|td ƒ‚‚YnXz|j|||f|Ž}WnBtk rÈ| ¡|dkrÂtd ƒ‚‚Yn| ¡‚YnXd |_ |S) zkOpen gzip compressed tar archive name for reading or writing. Appending is not allowed. ©rxryr[úmode must be 'r', 'w' or 'x'r)ÚGzipFilezgzip module is not availablerdNrxr·F) rJZgzipr›ržrr¦rrŒr‡r–)rrƒr„ršÚ compresslevelr•r›rÈr7r7r8Úgzopen–s0zTarFile.gzopenc Ks¸|dkrtdƒ‚zddlm}Wntk r<tdƒ‚YnX||pF|||d}z|j|||f|Ž}WnFttfk r˜| ¡|dkr’t dƒ‚‚Yn| ¡‚YnXd |_ |S) zlOpen bzip2 compressed tar archive name for reading or writing. Appending is not allowed. r™ršr)ÚBZ2Filer‘)rœrxznot a bzip2 fileF) rJrržržrrŒr¦ÚEOFErrorr‡rr–)rrƒr„ršrœr•ržrÈr7r7r8Úbz2open·s&zTarFile.bz2openc Ks¼|dkrtdƒ‚zddlm}m}Wntk r@tdƒ‚YnX||pJ|||d}z|j|||f|Ž}WnF|tfk rœ| ¡|dkr–t dƒ‚‚Yn| ¡‚YnXd |_ |S) zkOpen lzma compressed tar archive name for reading or writing. Appending is not allowed. r™ršr)ÚLZMAFiler¨r“)Úpresetrxznot an lzma fileF) rJr§r¡r¨ržrrŒrŸr‡rr–) rrƒr„ršr¢r•r¡r¨rÈr7r7r8ÚxzopenÓs&zTarFile.xzopenrŒrr r£)r”rrr’cCsˆ|jr dSd|_z`|jdkrn|j ttd¡|jtd7_t |jt ƒ\}}|dkrn|j tt |¡W5|js‚|j ¡XdS)zlClose the TarFile. In write-mode, two finishing zero blocks are appended to the archive. NTr|r$r) rœr–ršr‡r„r^r2rÉrÎr\Ú RECORDSIZE)r‚rbrcr7r7r8r‡ús z TarFile.closecCs"| |¡}|dkrtd|ƒ‚|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. Nzfilename %r not found)Ú _getmemberÚKeyError)r‚rƒrær7r7r8Ú getmembers  zTarFile.getmembercCs| ¡|js| ¡|jS)zŽReturn the members of the archive as a list of TarInfo objects. The list has the same order as the members in the archive. )Ú_checkr‡Ú_loadr†rˆr7r7r8Ú getmembersszTarFile.getmemberscCsdd„| ¡DƒS)z‹Return the members of the archive as a list of their names. It has the same order as the list returned by getmembers(). cSsg|] }|j‘qSr7rô)rZrær7r7r8r\(sz$TarFile.getnames..)rªrˆr7r7r8Úgetnames$szTarFile.getnamesc Cs^| d¡|dk r|j}|dkr$|}tj |¡\}}| tjd¡}| d¡}| ¡}||_ |dkr€|j stt  |¡}qŽt  |¡}nt  | ¡¡}d}|j}t  |¡rþ|j|jf} |j sæ|jdkræ| |jkræ||j| kræt} |j| }nt} | drü||j| <nht  |¡rt} nVt  |¡r"t} nDt  |¡r>t} t |¡}n(t  |¡rPt} nt   |¡rbt!} ndS||_||_"|j#|_$|j%|_&| tkr–|j'|_(nd|_(|j)|_*| |_+||_,t-räzt- .|j$¡d|_/Wnt0k râYnXt1rzt1 2|j&¡d|_3Wnt0k rYnX| tt!fkrZt4tdƒrZt4tdƒrZt 5|j6¡|_7t 8|j6¡|_9|S) aÒCreate 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. ÚawxNrùrr#rÚmajorÚminor):r¨rƒr{r%Ú splitdriver®ÚsepÚlstriprærårÚlstatÚstatÚfstatÚfilenoÚst_modeÚS_ISREGÚst_inoÚst_devÚst_nlinkrˆrgròÚS_ISDIRrúÚS_ISFIFOrmÚS_ISLNKreÚreadlinkÚS_ISCHRriÚS_ISBLKrkr„Úst_uidr)Úst_gidr*Úst_sizer'Úst_mtimer(rërìÚpwdÚgetpwuidr+r¦ÚgrpZgetgrgidr,r€r­Úst_rdevrír®rî) r‚rƒÚarcnameršZdrvræZstatresrìZstmdÚinoderër7r7r8Ú gettarinfo*s„      ÿ ÿ          zTarFile.gettarinfoT)r†cCsú| ¡|dkr|}|D]Ü}|r¤tt |j¡ƒtd|jp>|j|jpH|jfƒ|  ¡s`|  ¡rztdd|j |j fƒntd|j ƒtdt |j¡dd…ƒt|j| ¡r¶dnd ƒ|rî| ¡rØtd |jƒ| ¡rîtd |jƒtƒqdS) 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%s/%sz%10sz%d,%dz%10dz%d-%02d-%02d %02d:%02d:%02dr¹rùrz-> zlink to )r¨rlr³r—r„r+r)r,r*rjrlrírîr'r±Ú localtimer(rƒr2rfrìrhrk)r‚Úverboser†rær7r7r8rWs0 ÿÿÿz TarFile.list©Úfilterc Cs6| d¡|dkr|}|jdk rFtj |¡|jkrF| dd|¡dS| d|¡| ||¡}|dkrz| dd|¡dS|dk r¦||ƒ}|dkr¦| dd|¡dS| ¡rÒt|dƒ}|  ||¡W5QRXn`|  ¡r(|  |¡|r2t t  |¡ƒD]*}|j tj ||¡tj ||¡||d qún |  |¡dS) 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. r¬Nr$ztarfile: Skipped %rr#ztarfile: Unsupported type %rztarfile: Excluded %rrwrÎ)r¨rƒr{r%r€Ú_dbgrËrBrÚaddfiler2r”ÚlistdirÚaddrÅ)r‚rƒrÉÚ recursiverÏræÚfr7r7r8rÓ­s8      ÿ z TarFile.addcCs¾| d¡t |¡}| |j|j|j¡}|j |¡|jt |ƒ7_|j }|dk r®t ||j|j |dt |j tƒ\}}|dkrœ|j tt|¡|d7}|j|t7_|j |¡dS)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(). r¬N)rarr#)r¨rrrSr5r6ršr^rÎr1r…r[r'r\rÉr2r†rÄ)r‚ræršrWrarbrcr7r7r8rÑàs   zTarFile.addfileÚ.©Ú numeric_ownerc Csøg}|dkr|}|D]>}| ¡r:| |¡t |¡}d|_|j||| ¡ |dq|jdd„d| ¡|D]‚}tj  ||j ¡}z,|j |||d|  ||¡|  ||¡Wqptk rð}z"|jdkrЂn| dd |¡W5d}~XYqpXqpdS) a¶Extract 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. NéÀ©Ú set_attrsrØcSs|jSr†rô)rzr7r7r8ÚrŽz$TarFile.extractall..rr×r#ú tarfile: %s)r2rÄrr„ÚextractÚsortÚreverser{r%rÅrƒÚchownÚutimeÚchmodr r„rÐ)r‚r%r†rØZ directoriesræÚdirpathrŠr7r7r8Ú extractallùs.  ÿ  zTarFile.extractallrc Cs | d¡t|tƒr | |¡}n|}| ¡r>tj ||j¡|_ z"|j |tj ||j ¡||dWn¦t k rÆ}zH|j dkr€‚n6|jdkrž| dd|j¡n| dd|j|jf¡W5d}~XYnBtk r}z"|j dkræ‚n| dd|¡W5d}~XYnXdS)aìExtract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a 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. rxrÚrNr#rÝztarfile: %s %r)r¨rrr§rhr{r%rÅrìrñÚ_extract_memberrƒr¦r„ÚfilenamerÐÚstrerrorr )r‚Úmemberr%rÛrØrærŠr7r7r8rÞ!s*   þ   ( zTarFile.extractcCs‚| d¡t|tƒr | |¡}n|}| ¡s6|jtkrB| ||¡S| ¡sR|  ¡rzt|j t ƒrht dƒ‚q~|  | |¡¡SndSdS)zü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. Otherwise, None is returned. rxz'cannot extract (sym)link as file objectN)r¨rrr§rBrërCÚ fileobjectrhrfršr‹r Ú extractfileÚ_find_link_target)r‚rérær7r7r8rëGs      zTarFile.extractfilecCsT| d¡}| dtj¡}tj |¡}|r>tj |¡s>t |¡| ¡sN|  ¡rh|  dd|j |j f¡n|  d|j ¡|  ¡rŒ| ||¡nŽ| ¡r¢| ||¡nx| ¡r¸| ||¡nb| ¡sÈ| ¡rÖ| ||¡nD| ¡sæ|  ¡rô| ||¡n&|jtkr| ||¡n | ||¡|rP| |||¡|  ¡sP| ||¡| ||¡dS)z\Extract the TarInfo object tarinfo to a physical file called targetpath. rùr#z%s -> %sN)r3r®r{r°r%Údirnamer~ÚmakedirsrhrfrÐrƒrìrBÚmakefiler2ÚmakedirrnÚmakefiforjrlÚmakedevÚmakelinkrërCÚ makeunknownrárãrâ)r‚ræÚ targetpathrÛrØZ upperdirsr7r7r8ræfs4       zTarFile._extract_membercCs*zt |d¡Wntk r$YnXdS)z,Make a directory called targetpath. rÙN)r{ÚmkdirÚFileExistsError©r‚rærõr7r7r8rð—szTarFile.makedirc CsŽ|j}| |j¡|j}t|dƒb}|jdk rn|jD]"\}}| |¡t|||t|ƒq4| |j¡|  ¡nt|||jt|ƒW5QRXdS)z'Make a file called targetpath. rxN) ršrÀrâr…rrãr[rr'Útruncate)r‚rærõÚsourceraÚtargetrÎr'r7r7r8rï¡s      zTarFile.makefilecCs"| ||¡| dd|j¡dS)zYMake a file from a TarInfo object with an unknown type at targetpath. r#z9tarfile: Unknown file type %r, extracted as regular file.N)rïrÐrërør7r7r8rô±s ÿzTarFile.makeunknowncCs"ttdƒrt |¡ntdƒ‚dS)z'Make a fifo called targetpath. Úmkfifozfifo not supported by systemN)r€r{rür rør7r7r8rñ¹s  zTarFile.makefifocCs^ttdƒrttdƒstdƒ‚|j}| ¡r6|tjO}n |tjO}t ||t  |j |j ¡¡dS)zzShow listing of a tarfile)Úmetavarrz-ez --extractú+)rz zExtract tarfile into target dir)Únargsr rz-cz--create)zzzCreate tarfile from sourcesz-tz--testzTest if a tarfile is validrxrz{!r} is a tar archive.r#z{!r} is not a tar archive. r‹)rÍr$)r%rÖz{!r} file is extracted.z+{!r} file is extracted into {!r} directory.rr’r)r¬z.tgzz.xzz.txzz.bz2z.tbzz.tbz2z.tb2zw:ryz{!r} file created.)ÚargparseÚArgumentParserÚ add_argumentZadd_mutually_exclusive_groupÚ parse_argsZtestrrrªrkrirrÍrSÚexitrWrrÞr1r{ÚcurdirZ format_helpråZcreateÚpopr%ÚsplitextrÓ)r#rÚparserrOÚargsr_r”Ztfr(rZtar_namerYZextZ compressionsZtar_modeZ tar_filesÚ file_namer7r7r8ÚmainÑ s–  ÿ  ÿ þ þ ÿ          ÿ   õ r.Ú__main__)`rqÚversionÚ __author__Ú __credits__Úbuiltinsrrrir{rÖrZr³r±rVrÚrerÅržrÇÚAttributeErrorÚNotImplementedErrorrr¦Ú NameErrorÚ__all__r2rÉr¤r rrrrròr/rgrerirkrúrmZCONTTYPEr r r0rrr?r rrrrCrcr4r_rRrrHr`rƒr Úgetfilesystemencodingr9r>rNrTrXr[rlÚ Exceptionrr rrr r rrrsrtrKrurvr‹Úobjectr—rÍÚBufferedReaderráÚcompilerMrrrr.rnr7r7r7r8Ús      ýüÿÿ ú  sh a! W