/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__/shutil.cpython-38.pyc (37219B)
U ʦi@sdZddlZddlZddlZddlZddlZddlZzddlZ[dZWne k r^dZYnXzddl Z [ dZ Wne k rdZ YnXzddl Z [ dZ Wne k rdZ YnXzddlmZWne k rdZYnXzddlmZWne k r dZYnXejdkZdZZejdkr6ddlZnerDddlZerNd nd Zeed ohejd aeoxeed ZdZdddddddddddddddddd d!d"d#d$d%d&d'gZGd(ddeZGd)d'd'eZ Gd*ddeZ!Gd+ddeZ"Gd,d-d-eZ#Gd.d/d/e$Z%Gd0d1d1e$Z&d2d3Z'd4d5Z(efd6d7Z)dd8dZ*d9d:Z+d;d<Z,d=d>Z-dd?d@dZ.dd?dAdZ/eedBrdd?dCdDZ0ndEdDZ0dd?dFdZ1dd?dGdZ2dd?dHdZ3dId#Z4ddJdKZ5dde3ddfdLdZ6eej7dMrdNdOZ8dPdQZ9ndRdOZ8dSdQZ9dTdUZ:dVdWZ;ejhej?kofej@ejAkofejejBkZCddXdZDeCeD_EdYdZZFe3fd[dZGd\d]ZHd^d_ZId`daZJdbdcZKddedfZLddgdhZMdieLdjgdkfiZNereLdlgdmfeNdn<eMgdofeNdp<e r eLdqgdrfeNds<e r eLdtgdufeNdv<dwdZOddydZPdzdZQdd{dZRd|dZSd}d~ZTddd ZUdd!ZVddZWddZXddZYdgeYgdkfdgeXgdofdZZerddgeYgdmfeZdn<e rddgeYgdrfeZds<e rddgeYgdufeZdv<ddZ[ddd"Z\eedr@e]de^ddZ_de_j`_de_ja_de_jb_ddZcn$erde]de^ddZ_ddZcddd$Zdddd&ZeddZfejgejhBdfdd%ZidS)zUtility functions for copying and archiving files and directory trees. XXX The functions here don't copy the resource fork or other metadata on Mac. NTF)getpwnam)getgrnamntposixiisendfileZlinux _fcopyfilez%.COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS;.MSC copyfileobjcopyfilecopymodecopystatcopycopy2copytreemovermtreeErrorSpecialFileError ExecError make_archiveget_archive_formatsregister_archive_formatunregister_archive_formatget_unpack_formatsregister_unpack_formatunregister_unpack_formatunpack_archiveignore_patternschownwhichget_terminal_size SameFileErrorc@s eZdZdS)rN)__name__ __module__ __qualname__r$r$/usr/lib/python3.8/shutil.pyrEsc@seZdZdZdS)r z5Raised when source and destination are the same file.Nr!r"r#__doc__r$r$r$r%r Hsc@seZdZdZdS)rz|Raised when trying to do a kind of operation (e.g. copying) which is not supported on a special file (e.g. a named pipe)Nr&r$r$r$r%rKsc@seZdZdZdS)rz+Raised when a command could not be executedNr&r$r$r$r%rOsc@seZdZdZdS) ReadErrorz%Raised when an archive cannot be readNr&r$r$r$r%r(Rsr(c@seZdZdZdS) RegistryErrorzVRaised when a registry operation with the archiving and unpacking registries failsNr&r$r$r$r%r)Usr)c@seZdZdZdS)_GiveupOnFastCopyzuRaised as a signal to fallback on using raw read()/write() file copy when fast-copy functions fail to do so. Nr&r$r$r$r%r*Ysr*c Csz|}|}Wn*tk r>}z t|W5d}~XYnXzt|||WnTtk r}z6|j|_|j|_|j t j t j hkrt|n|dW5d}~XYnXdS)zhCopy a regular file content or metadata by using high-performance fcopyfile(3) syscall (macOS). N) fileno Exceptionr*rrOSErrornamefilename filename2errnoEINVALENOTSUP)fsrcfdstflagsinfdoutfderrr$r$r%_fastcopy_fcopyfile^s  r:c CsDz|}|}Wn*tk r>}z t|W5d}~XYnXztt|jd}Wntk rnd}YnXtj dkrt |d}d}zt ||||}Wntk r&}zj|j |_ |j |_|jtjkrdat||jtjkr|d|dkrt|dtjdkrt||W5d}~XYqX|dkr6q@||7}qdS)zCopy data from one regular mmap-like fd to another by using high-performance sendfile(2) syscall. This should work on Linux >= 2.6.33 only. Niili@rF)r+r,r*maxosfstatst_sizer-sysmaxsizeminrr.r/r0r1ZENOTSOCK_USE_CP_SENDFILEZENOSPClseekSEEK_CUR)r4r5r7r8r9Z blocksizeoffsetZsentr$r$r%_fastcopy_sendfilers8        rFc Csn|j}|j}tt|L}||}|s*q`q||krV|d|}||W5QRXq||qW5QRXdS)zreadinto()/memoryview() based variant of copyfileobj(). *fsrc* must support readinto() method and both files must be open in binary mode. N)readintowrite memoryview bytearray)r4r5lengthZ fsrc_readinto fdst_writeZmvnZsmvr$r$r%_copyfileobj_readintosrNcCs0|st}|j}|j}||}|s"q,||qdS)z=copy data from file-like object fsrc to file-like object fdstN) COPY_BUFSIZEreadrH)r4r5rKZ fsrc_readrLZbufr$r$r%rscCst|tjrJttjdrJztj|t|WStk rHYdSXttjdr~ztj||WStk r|YdSXtj tj |tj tj |kS)NsamestatFsamefile) isinstancer<DirEntryhasattrpathrQstatr-rRnormcaseabspathsrcdstr$r$r% _samefiles r]cCst|tjr|St|SN)rSr<rTrWfnr$r$r%_statsracCs t|tjr|Stj|Sr^)rSr<rT is_symlinkrVislinkr_r$r$r%_islinksrdfollow_symlinksc Cstd||t||r(td||d}t||gD]j\}}z t|}Wntk r`Yq8Xt |j rt |t j r|jn|}td|tr8|dkr8|j}q8|st|rt t ||n t|d}t|d}tr,z,t||tj|WW5QRW5QRStk r(YnXntrtz(t|||WW5QRW5QRStk rpYnXn>tr|dkrt||t|t|W5QRW5QRSt ||W5QRXW5QRX|S)zCopy data from src to dst in the most efficient way possible. If follow_symlinks is not set and src is a symbolic link, a new symlink will be created instead of copying the file it points to. zshutil.copyfilez{!r} and {!r} are the same filerz`%s` is a named piperbwb)!r?auditr]r format enumeraterar-rWS_ISFIFOst_moderSr<rTrVr_WINDOWSr>rdsymlinkreadlinkopen_HAS_FCOPYFILEr:rZ_COPYFILE_DATAr*rBrFrNrArOr) r[r\rf file_sizeir`str4r5r$r$r%r sD       cCsptd|||sFt|rFtj|rFttdr@tjtj}}qRdSn t tj }}||}||t |j dS)zCopy mode bits from src to dst. If follow_symlinks is not set, symlinks aren't followed if and only if both `src` and `dst` are symlinks. If `lchmod` isn't available (e.g. Linux) this method does nothing. zshutil.copymodelchmodN)r?rirdr<rVrcrUlstatrvrachmodrWS_IMODErm)r[r\rfZ stat_funcZ chmod_funcrur$r$r%r !s   listxattrc Csztj||d}Wn@tk rR}z"|jtjtjtjfkr<WYdSd}~XYnX|D]j}z&tj|||d}tj||||dWqXtk r}z |jtj tjtjtjfkrW5d}~XYqXXqXdS)zCopy extended filesystem attributes from `src` to `dst`. Overwrite existing attributes. If `follow_symlinks` is false, symlinks won't be followed. reN) r<rzr-r1r3ZENODATAr2getxattrsetxattrZEPERM)r[r\rfnameser.valuer$r$r% _copyxattr7s rcOsdSr^r$)argskwargsr$r$r%rOsc s`td||ddddd|p6t|o4tj| }|rJfdd}n fdd}t|tjrp|j|d }n|d ||d }t |j }|d ||j |j f|dt |||d z|d |||d Wntk rYnXt|d r\z|d||j|d WnVtk rZ}z6dD]*}tt|r|jtt|krqJqW5d}~XYnXdS)aCopy file metadata Copy the permission bits, last access time, last modification time, and flags from `src` to `dst`. On Linux, copystat() also copies the "extended attributes" where possible. The file contents, owner, and group are unaffected. `src` and `dst` are path-like objects or path names given as strings. If the optional flag `follow_symlinks` is not set, symlinks aren't followed if and only if both `src` and `dst` are symlinks. zshutil.copystatN)nsrfcWsdSr^r$)rrfrr$r$r%_nop`szcopystat.._nopcs tt|Sr^)getattrr<r.rr$r%lookupgszcopystat..lookupcstt|}|tjkr|SSr^)rr<supports_follow_symlinks)r.r`rr$r%rls  rerWutimerxst_flagsZchflags)Z EOPNOTSUPPr3)r?rirdr<rVrcrSrTrWryrm st_atime_ns st_mtime_nsrNotImplementedErrorrUrr-r1r) r[r\rfZfollowrrumodewhyr9r$rr%r Rs4       cCsBtj|r"tj|tj|}t|||dt|||d|S)a3Copy data and mode bits ("cp src dst"). Return the file's destination. The destination may be a directory. If follow_symlinks is false, symlinks won't be followed. This resembles GNU's "cp -P src dst". If source and destination are the same file, a SameFileError will be raised. re)r<rVisdirjoinbasenamer r r[r\rfr$r$r%r s cCsBtj|r"tj|tj|}t|||dt|||d|S)a0Copy data and metadata. Return the file's destination. Metadata is copied with copystat(). Please see the copystat function for more information. The destination may be a directory. If follow_symlinks is false, symlinks won't be followed. This resembles GNU's "cp -P src dst". re)r<rVrrrr r rr$r$r%r s csfdd}|S)zFunction that can be used as copytree() ignore parameter. Patterns is a sequence of glob-style patterns that are used to exclude filescs(g}D]}|t||qt|Sr^)extendfnmatchfilterset)rVr} ignored_namespatternpatternsr$r%_ignore_patternssz)ignore_patterns.._ignore_patternsr$)rrr$rr%rs c Cs>|dk r$|t|dd|D}nt}tj||dg} |tkpJ|tk} |D]~} | j|krbqPtj|| j} tj|| j} | r| n| }z| }|rtjdkr| j dd}|j t j krd}|r8t | }|rt|| t|| | dnBtj|s |r WqP| r,t|| ||||dn ||| n*| rXt|| ||||dn ||| WqPtk r}z| |jdW5d}~XYqPtk r}z| | | t|fW5d}~XYqPXqPzt||WnJtk r*}z*t|d ddkr| ||t|fW5d}~XYnX| r:t| |S) NcSsg|] }|jqSr$r).0xr$r$r% sz_copytree..)exist_okrFre) dirs_exist_okrZwinerror)r<fspathrmakedirsr r r.rVrrbrWst_reparse_tagIO_REPARSE_TAG_MOUNT_POINTrpror existsis_dirrrrrr-appendstrr)entriesr[r\symlinksignore copy_functionignore_dangling_symlinksrrerrorsZ use_srcentryZsrcentryZsrcnameZdstnameZsrcobjrbrwlinktor9rr$r$r% _copytrees`             (&rc CsDtd||t|}t|}W5QRXt||||||||dS)aeRecursively copy a directory tree and return the destination directory. dirs_exist_ok dictates whether to raise an exception in case dst or any missing parent directory already exists. If exception(s) occur, an Error is raised with a list of reasons. If the optional symlinks flag is true, symbolic links in the source tree result in symbolic links in the destination tree; if it is false, the contents of the files pointed to by symbolic links are copied. If the file pointed by the symlink doesn't exist, an exception will be added in the list of errors raised in an Error exception at the end of the copy process. You can set the optional ignore_dangling_symlinks flag to true if you want to silence this exception. Notice that this has no effect on platforms that don't support os.symlink. The optional ignore argument is a callable. If given, it is called with the `src` parameter, which is the directory being visited by copytree(), and `names` which is the list of `src` contents, as returned by os.listdir(): callable(src, names) -> ignored_names Since copytree() is called recursively, the callable will be called once for each directory that is copied. It returns a list of names relative to the `src` directory that should not be copied. The optional copy_function argument is a callable that will be used to copy each file. It will be called with the source path and the destination path as arguments. By default, copy2() is used, but any function that supports the same signature (like copy()) can be used. zshutil.copytree)rr[r\rrrrr)r?rir<scandirlistr) r[r\rrrrrZitrrr$r$r%rs&  st_file_attributescCsPz4|jdd}t|jo2|jtj@o0|jtjk WStk rJYdSXdSNFre)rWS_ISDIRrmrFILE_ATTRIBUTE_REPARSE_POINTrrr-)entryrur$r$r% _rmtree_isdir6s    rcCsLz0t|}t|jp.|jtj@o.|jtjkWSt k rFYdSXdS)NF) r<rwrWS_ISLNKrmrrrrr-)rVrur$r$r%_rmtree_islink?s    rcCs*z|jddWStk r$YdSXdSr)rr-)rr$r$r%rHscCs tj|Sr^)r<rVrc)rVr$r$r%rNsc Cs&z"t|}t|}W5QRXWn*tk rL|tj|tg}YnX|D]}|j}t|rz|rvtdWn,tk r|tjj |tYqRYnXt ||qRzt |WqRtk r|tj |tYqRXqRzt |Wn(tk r |tj |tYnXdS)N%Cannot call rmtree on a symbolic link) r<rrr-r?exc_inforVrrbrc_rmtree_unsafeunlinkrmdir)rVonerror scandir_itrrfullnamer$r$r%rRs0     rc Cs.z"t|}t|}W5QRXWn@tk rb}z"||_|tj|tWYdSd}~XYnX|D]}tj||j }z|j dd}Wntk rd}YnNX|rz|j dd} t | j }Wn*tk r|tj|tYqhYnX|rztj|j tj|d} Wn(tk r:|tj|tYnXztj| t| rt| ||ztj|j |dWn(tk r|tj|tYnXn8z tdWn*tk r|tjj|tYnXW5t| Xqhztj|j |dWqhtk r&|tj|tYqhXqhdS)NFre)dir_fdr)r<rrr-r/r?rrVrr.rrWrrmrwrqO_RDONLYcloserQr=_rmtree_safe_fdrrcr) topfdrVrrrr9rrrorig_stdirfdr$r$r%rqsR       rc Cstd||rdd}n|dkr*dd}tr`t|trDt|}zt|}Wn(tk rz|tj|t YdSXzt |tj }Wn(tk r|tj |t YdSXztj |t|rt|||zt|Wn(tk r|tj|t YnXn8z tdWn*tk rL|tj j|t YnXW5t |XnNzt|rttdWn,tk r|tj j|t YdSXt||SdS)aRecursively delete a directory tree. If ignore_errors is set, errors are ignored; otherwise, if onerror is set, it is called to handle the error with arguments (func, path, exc_info) where func is platform and implementation dependent; path is the argument to that function that caused it to fail; and exc_info is a tuple returned by sys.exc_info(). If ignore_errors is false and onerror is None, an exception is raised. z shutil.rmtreecWsdSr^r$rr$r$r%rszrmtree..onerrorNcWsdSr^r$rr$r$r%rsr)r?ri_use_fd_functionsrSbytesr<fsdecoderwr,rrqrrrVrQr=rrr-rcrr)rV ignore_errorsrrfdr$r$r%rsJ        cCs&tjjtjjpd}tj||S)N)r<rVsepaltseprrstrip)rVrr$r$r% _basenamesrc CsTtd|||}tj|rbt||r8t||dStj|t|}tj |rbt d|zt||Wnt k rNtj |rt |}t||t|ntj|r6t||rt d||ft|s t|tjst|rtjdkrtd||ft|||ddt|n|||t|YnX|S) a+Recursively move a file or directory to another location. This is similar to the Unix "mv" command. Return the file or directory's destination. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already exists but is not a directory, it may be overwritten depending on os.rename() semantics. If the destination is on our current filesystem, then rename() is used. Otherwise, src is copied to the destination and then removed. Symlinks are recreated under the new name if os.rename() fails because of cross filesystem renames. The optional `copy_function` argument is a callable that will be used to copy the source or it will be delegated to `copytree`. By default, copy2() is used, but any function that supports the same signature (like copy()) can be used. A lot more could be done here... A look at a mv.c shows a lot of the issues this implementation glosses over. z shutil.moveNz$Destination path '%s' already existsz.Cannot move a directory '%s' into itself '%s'.darwinzKCannot move the non-empty directory '%s': Lacking write permission to '%s'.T)rr)r?rir<rVrr]renamerrrrr-rcrpror _destinsrc _is_immutableaccessW_OKlistdirplatformPermissionErrorrr)r[r\rZreal_dstrr$r$r%rsL              cCsVtj|}tj|}|tjjs2|tjj7}|tjjsL|tjj7}||Sr^)r<rVrYendswithr startswithrZr$r$r%r/s    rcCs(t|}tjtjg}t|do&|j|kS)Nr)rarW UF_IMMUTABLE SF_IMMUTABLErUr)r[ruZimmutable_statesr$r$r%r8s rcCsNtdks|dkrdSz t|}Wntk r8d}YnX|dk rJ|dSdS)z"Returns a gid, given a group name.N)rKeyErrorr.resultr$r$r%_get_gid=s  rcCsNtdks|dkrdSz t|}Wntk r8d}YnX|dk rJ|dSdS)z"Returns an uid, given a user name.Nr)rrrr$r$r%_get_uidIs  rgzipcs |dkrd}nDtr |dkr d}n2tr2|dkr2d}n trD|dkrDd}ntd|d dl} |rfd |nd} |d | } tj| } | rtj | s|dk r| d | |st | |dk r| d t t fdd} |s| | d|}z|j|| dW5|X| S)aCreate a (possibly compressed) tar file from all the files under 'base_dir'. 'compress' must be "gzip" (the default), "bzip2", "xz", or None. 'owner' and 'group' can be used to define an owner and a group for the archive that is being built. If not provided, the current owner and group will be used. The output tar file will be named 'base_name' + ".tar", possibly plus the appropriate compression extension (".gz", ".bz2", or ".xz"). Returns the output filename. NrrZgzbzip2bz2xzzCbad value for 'compress', or compression format not supported : {0}r..tar creating %szCreating tar archivecs,dk r|_|_dk r(|_|_|Sr^)gidZgnameuiduname)Ztarinforgroupownerrr$r% _set_uid_gidsz#_make_tarball.._set_uid_gidzw|%s)r)_ZLIB_SUPPORTED_BZ2_SUPPORTED_LZMA_SUPPORTED ValueErrorrjtarfiler<rVdirnamerinforrrrqradd) base_namebase_dircompressverbosedry_runrrloggerZtar_compressionrZ compress_extZ archive_name archive_dirrtarr$rr% _make_tarballUs>          rc Csnddl}|d}tj|}|rNtj|sN|dk r@|d||sNt||dk rd|d|||sj|j|d|jd}tj |} | tj kr| | | |dk r|d| t |D]\} } } t | D]:} tj tj| | } | | | |dk r|d| q| D]L} tj tj| | } tj| r| | | |dk r|d| qqW5QRX|S) zCreate a zip file from all the files under 'base_dir'. The output zip file will be named 'base_name' + ".zip". Returns the name of the output zip file. rN.ziprz#creating '%s' and adding '%s' to itw)Z compressionz adding '%s')zipfiler<rVrrrrZipFileZ ZIP_DEFLATEDnormpathcurdirrHwalksortedrisfile)rrrrrr Z zip_filenamerZzfrVdirpathZdirnames filenamesr.r$r$r% _make_zipfilesH           rr)rNzuncompressed tar file)rrzgzip'ed tar-fileZgztarzZIP filezip)rrzbzip2'ed tar-fileZbztar)rrzxz'ed tar-fileZxztarcCsddtD}||S)zReturns a list of supported formats for archiving and unarchiving. Each element of the returned sequence is a tuple (name, description) cSsg|]\}}||dfqS)rr$)rr.registryr$r$r%rsz'get_archive_formats..)_ARCHIVE_FORMATSitemssortZformatsr$r$r%rs rcCst|dkr g}t|s td|t|ttfs6td|D]&}t|ttfrXt|dkr:tdq:|||ft|<dS)auRegisters an archive format. name is the name of the format. function is the callable that will be used to create archives. If provided, extra_args is a sequence of (name, value) tuples that will be passed as arguments to the callable. description can be provided to describe the format, and will be returned by the get_archive_formats() function. NzThe %s object is not callablez!extra_args needs to be a sequencerz+extra_args elements are : (arg_name, value))callable TypeErrorrStuplerlenr)r.function extra_args descriptionZelementr$r$r%rs   cCs t|=dSr^)rrr$r$r%rsc  Cstd||||t} |dk rP|dk r6|d|tj|}|sPt||dkr^tj}||d} z t |} Wn"t k rt d|dYnX| d} | dD]\} }|| | <q|dkr|| d <|| d <z| ||f| }W5|dk r|dk r|d | t| X|S) aCreate an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific extension; 'format' is the archive format: one of "zip", "tar", "gztar", "bztar", or "xztar". Or any other registered format. 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir into 'root_dir' before creating the archive. 'base_dir' is the directory where we start archiving from; ie. 'base_dir' will be the common prefix of all files and directories in the archive. 'root_dir' and 'base_dir' both default to the current directory. Returns the name of the archive file. 'owner' and 'group' are used when creating a tar archive. By default, uses the current owner and group. zshutil.make_archiveNzchanging into '%s')rrzunknown archive format '%s'rrrrzchanging back to '%s') r?rir<getcwddebugrVrYchdirrrrr)rrjZroot_dirrrrrrrZsave_cwdr format_infofuncargvalr/r$r$r%rs8          cCsddtD}||S)zReturns a list of supported formats for unpacking. Each element of the returned sequence is a tuple (name, extensions, description) cSs"g|]\}}||d|dfqS)rr$)rr.rr$r$r%r3sz&get_unpack_formats..)_UNPACK_FORMATSrrrr$r$r%r-s c Csji}tD]\}}|dD] }|||<qq |D]$}||kr0d}t||||fq0t|sftddS)z+Checks what gets registered as an unpacker.rz!%s is already registered for "%s"z*The registered function must be a callableN)r+rr)rr) extensionsrr Zexisting_extensionsr.rext extensionmsgr$r$r%_check_unpack_options8s   r0cCs,|dkr g}t|||||||ft|<dS)aMRegisters an unpack format. `name` is the name of the format. `extensions` is a list of extensions corresponding to the format. `function` is the callable that will be used to unpack archives. The callable will receive archives to unpack. If it's unable to handle an archive, it needs to raise a ReadError exception. If provided, `extra_args` is a sequence of (name, value) tuples that will be passed as arguments to the callable. description can be provided to describe the format, and will be returned by the get_unpack_formats() function. N)r0r+)r.r,rr r!r$r$r%rJs cCs t|=dS)z*Removes the pack format from the registry.N)r+rr$r$r%r`scCs&tj|}tj|s"t|dS)z1Ensure that the parent directory of `path` existsN)r<rVrrr)rVrr$r$r%_ensure_directoryds  r1c Csddl}||std|||}z|D]}|j}|ds2d|krPq2tj j |f| d}|snq2t || ds2||j}t|d}z||W5|~Xq2W5|XdS)z+Unpack zip `filename` to `extract_dir` rNz%s is not a zip file/z..rh)r Z is_zipfiler(r rZinfolistr/rr<rVrsplitr1rrPrqrH) r/ extract_dirr rrr.targetdatafr$r$r%_unpack_zipfilejs*        r8cCsXddl}z||}Wn"|jk r8td|YnXz||W5|XdS)zAUnpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir` rNz/%s is not a compressed or uncompressed tar file)rrqZTarErrorr(rZ extractall)r/r4rZtarobjr$r$r%_unpack_tarfiles r9rr )rrz.tar.gzz.tgzz.tar.bz2z.tbz2z.tar.xzz.txzcCs:tD],\}}|dD]}||r|SqqdS)Nr)r+rr)r/r.rr.r$r$r%_find_unpack_formats   r:cCstd||||dkr t}t|}t|}|dk rz t|}Wn$tk rltd|dYnX|d}|||ft |dnHt |}|dkrt d|t|d}t t|d}|||f|dS)a Unpack an archive. `filename` is the name of the archive. `extract_dir` is the name of the target directory, where the archive is unpacked. If not provided, the current working directory is used. `format` is the archive format: one of "zip", "tar", "gztar", "bztar", or "xztar". Or any other registered format. If not provided, unpack_archive will use the filename extension and see if an unpacker was registered for that extension. In case none is found, a ValueError is raised. zshutil.unpack_archiveNzUnknown unpack format '{0}'r"rzUnknown archive format '{0}') r?rir<r#rr+rrrjdictr:r()r/r4rjr&r'rr$r$r%rs$    statvfs disk_usageZusageztotal used freezTotal space in byteszUsed space in byteszFree space in bytescCs@t|}|j|j}|j|j}|j|j|j}t|||S)zReturn disk usage statistics about the given path. Returned value is a named tuple with attributes 'total', 'used' and 'free', which are the amount of total, used and free space, in bytes. )r<r<f_bavailf_frsizef_blocksf_bfree_ntuple_diskusage)rVrufreetotalusedr$r$r%r=s    cCs"t|\}}||}t|||S)zReturn disk usage statistics about the given path. Returned values is a named tuple with attributes 'total', 'used' and 'free', which are the amount of total, used and free space, in bytes. )rZ _getdiskusagerB)rVrDrCrEr$r$r%r=scCstd||||dkr(|dkr(td|}|}|dkr>d}n(t|trft|}|dkrftd||dkrtd}n(t|tst |}|dkrtd|t |||dS)zChange owner user and group of the given path. user and group can be the uid/gid or the user/group names, and in that case, they are converted to their respective uid/gid. z shutil.chownNzuser and/or group must be setzno such user: {!r}zno such group: {!r}) r?rirrSrr LookupErrorrjintrr<r)rVuserrZ_userZ_groupr$r$r%rs$  Pc Cszttjd}Wnttfk r.d}YnXzttjd}Wnttfk r^d}YnX|dksp|dkrzttj}Wn$t tt fk rt |}YnX|dkr|j }|dkr|j }t ||fS)aGet the size of the terminal window. For each of the two dimensions, the environment variable, COLUMNS and LINES respectively, is checked. If the variable is defined and the value is a positive integer, it is used. When COLUMNS or LINES is not defined, which is the common case, the terminal connected to sys.__stdout__ is queried by invoking os.get_terminal_size. If the terminal size cannot be successfully queried, either because the system doesn't support querying, or because we are not connected to a terminal, the value given in fallback parameter is used. Fallback defaults to (80, 24) which is the default size used by many terminal emulators. The value returned is a named tuple of type os.terminal_size. ZCOLUMNSrZLINES)rHr<environrrrr? __stdout__r+AttributeErrorr- terminal_sizecolumnslines)ZfallbackrQrRsizer$r$r%r s$  cCs&tj|o$t||o$tj| Sr^)r<rVrrr)r`rr$r$r% _access_checkQs rTc stjrt|rSdStt}|dkrttjdd}|dkrtztd}Wnt t fk rrtj }YnX|s|dS|rt |}| t tj}nt|}| tj}tjdkrTtj}|rt |}||kr|d|tdpt}dd| tjD}|r d d|D}tfd d |Dr@g}nfd d|D}ng}t}|D]X} tj| } | |krd|| |D],} tj| | } t| |r| SqqddS) a3Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. NPATHCS_PATHZwin32rZPATHEXTcSsg|] }|r|qSr$r$rr-r$r$r%rszwhich..cSsg|]}t|qSr$)r<fsencoderWr$r$r%rsc3s |]}|VqdSr^)lowerrrWcmdr$r% szwhich..csg|] }|qSr$r$rWrZr$r%rs)r<rVrrTrSrrMgetconfstrrOrdefpathrXr3pathseprr?rrinsertgetenv_WIN_DEFAULT_PATHEXTanyrrXrr) r[rrVZ use_bytesrZpathext_sourceZpathextfilesseendirZnormdirZthefiler.r$rZr%rVsV              )r)F)FN)rrrNNN)rrN)Nr)NNrrNNN)Nr)NN)NN)rJ)jr'r<r?rWr collectionsr1zlibr ImportErrorrrZlzmarpwdrZgrprr.rnrrrOrUrrrBrrrc__all__r-rr rrr(r,r)r*r:rFrNrr]rardr r rr r r rrr stat_resultrrrrrqrrsupports_dir_fdr supports_fdrrrZavoids_symlink_attacksrrrrrrrrrrrrrrr0rrr1r8r9r+r:rr namedtuplerBrDrErCr=rrrTF_OKX_OKrr$r$r$r%st          @  7 B A . 4   > ?    A -   8  "      *       1