python (3.12.0)

(root)/
lib/
python3.12/
__pycache__/
shutil.cpython-312.opt-1.pyc

ˑekVdZddlZddlZddlZddlZddlZddlZddlZ	ddlZ[dZ		ddlZ[dZ	ddl
Z
[
dZejdk(ZdxZZejdk(rddlZnerddlZej&dk(rddlZndZerdnd	Zeed
xrej&j/daexr	eedZd
ZgdZGddeZGddeZGddeZGddeZ GddeZ!Gdde"Z#Gdde"Z$dZ%dZ&efdZ'drd Z(d!Z)d"Z*d#Z+dd$d%Z,dd$d&Z-eed'rdd$d(Z.nd)Z.dd$d*Z/dd$d+Z0dd$d,Z1d-Z2	dsd.Z3dde1ddfd/Z4eejjd0rd1Z6nd2Z6d3Z7d4Z8ejrejejtejvhejxkxr2ejzej|vxrejej~vZ@dtddd5d6ZAe@eA_Bd7ZCe1fd8ZDd9ZEd:ZFd;ZGd<ZH		dud=ZI		dvd>ZJdeI_KdeJ_Kd?eId@gdAfiZLe	reIdBgdCfeLdD<eJgdEfeLdF<er	eIdGgdHfeLdI<er	eIdJgdKfeLdL<dMZMdwdNZNdOZO		dxdPZPdQZQdRZR		dwdSZSdTZTdUZUdVZVddWdXZWdYgeWgdAfdZgeVgdEfd[ZXe	rd\d]geWgdCfeXdD<erd^d_geWgdHfeXdI<erd`dageWgdKfeXdL<dbZYdyddWdcZZeeddr[ejdeejdfdgZ]dhe]j_die]j_dje]j_dkZan)er'ejdeejdfdgZ]dlZadydmZbdzdnZcdoZddpZeejejzdfdqZhy#e
$rdZ	YdwxYw#e
$rdZYjwxYw#e
$rdZYpwxYw){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.

NTFntposixwin32iisendfilelinux
_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eZdZy)rN)__name__
__module____qualname__:/BuggyBox/python/3.12.0/bootstrap/lib/python3.12/shutil.pyrrCsr'rceZdZdZy)r!z5Raised when source and destination are the same file.Nr#r$r%__doc__r&r'r(r!r!Fs?r'r!ceZdZdZy)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(rrIs;r'rceZdZdZy)rz+Raised when a command could not be executedNr*r&r'r(rrMs5r'rceZdZdZy)	ReadErrorz%Raised when an archive cannot be readNr*r&r'r(r/r/Ps/r'r/ceZdZdZy)
RegistryErrorzVRaised when a registry operation with the archiving
    and unpacking registries failsNr*r&r'r(r1r1Ss&r'r1ceZdZdZy)_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(r3r3Wsr'r3c	|j}|j}	tj|||y#t$r}t|d}~wwxYw#t
$ra}|j|_|j|_|jtjtjhvrt||dd}~wwxYw)zhCopy a regular file content or metadata by using high-performance
    fcopyfile(3) syscall (macOS).
    N)fileno	Exceptionr3rrOSErrornamefilename	filename2errnoEINVALENOTSUP)fsrcfdstflagsinfdoutfderrs      r(_fastcopy_fcopyfilerD\s%{{}
 
ue,	%$$%
 yy		
99u}}55#C((4
 s- ;A	AAA	C AB<<Cc	|j}|j}	tt	j
|jd}tjdkrt|d}d}		t	j||||}|dk(ry||z
}%#t$r}t|d}~wwxYw#t$rd}YpwxYw#t$r}|j|_
|j|_|jtj k(r
dat||jtj$k(r|d|dk(r3t	j&|dtj(dk(rt||d}~wwxYw)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)r5r6r3maxosfstatst_sizer7sysmaxsizeminrr8r9r:r;ENOTSOCK_USE_CP_SENDFILEENOSPClseekSEEK_CUR)r>r?rArBrC	blocksizeoffsetsents        r(_fastcopy_sendfilerUpsV%{{}
..8	
{{W	7+	
F
	;;udFI>D,qydNF5%%$$%		99CL IICMyyENN*$) ',,yyELL(t#{rxxq"++>!C',,I'	sA B)B//C	B,B''B,/B=<B=	E4	B&E//E4c|j}|j}tt|5}	||}|sn%||kr|d|5}||dddn	||0dddy#1swYxYw#1swYyxYw)zreadinto()/memoryview() based variant of copyfileobj().
    *fsrc* must support readinto() method and both files must be
    open in binary mode.
    N)readintowrite
memoryview	bytearray)r>r?length
fsrc_readinto
fdst_writemvnsmvs        r(_copyfileobj_readintorasMMMJ	If%	&
"b!AVV$ssO$2

$$

s#A4	A(
A4(A1	-A44A=c|st}|j}|j}||x}r||||x}ryy)z=copy data from file-like object fsrc to file-like object fdstN)COPY_BUFSIZEreadrX)r>r?r[	fsrc_readr]bufs      r(r	r	sE		IJ6"
"#
"36"
"#
"r'ct|tjr\ttjdrB	tjj|j
tj|Sttjdr!	tjj||Stjjtjj|tjjtjj|k(S#t$rYywxYw#t$rYywxYw)NsamestatFsamefile)
isinstancerGDirEntryhasattrpathrhstatr7rinormcaseabspathsrcdsts  r(	_samefilerts#r{{#(D	77##CHHJ==rww
#	77##C--

GGRWW__S12GGRWW__S12
34				s$AD+D:+	D76D7:	EEct|tjr|jStj|SN)rjrGrkrnfns r(_statrys("2r{{32779DDr'ct|tjr|jStjj|Srv)rjrGrk
is_symlinkrmislinkrws r(_islinkr}s-(R[[92==?Qrww~~b?QQr'follow_symlinksc
tjd||t||rtdj	||d}t||gD]\}}	t
|}tj|jr6t|tjr|jn|}td|ztsn|dk(st|j }|s6t%|r+tj&tj(|||St+|d5}	t+|d5}t,r0	t/||t0j2|cdddcdddSt6r!	t9|||cdddcdddStr4|dkDr/t;||t=|t>|cdddcdddStA||dddddd|S#t"$rYwxYw#t4$rY9wxYw#t4$rYHwxYw#1swYAxYw#tB$r4}	tjjE|stGd||	d}	~	wwxYw#1swY|SxYw)	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 piperbwbNzDirectory does not exist: )$rJauditrtr!format	enumerateryrnS_ISFIFOst_moderjrGrkrmr_WINDOWSrIr7r}symlinkreadlinkopen_HAS_FCOPYFILErDr_COPYFILE_DATAr3rNrUrarLrcr	IsADirectoryErrorexistsFileNotFoundError)
rrrsr	file_sizeirxstr>r?es
          r(r
r
sCIIc*c=DDS#NOOIC:&'2	'rB}}RZZ( *2r{{ ;RWW&'='BCCAFJJ	'ws|


2;;s#S)DJA#t_	
#t_,%!/dE<P<PQ#&,,		*!.tT:#&,,		&"i!m-dD#i:VW"',,		. d++,	@J]		, 1! ! 1! !,,0%
ww~~c*+.H,NOUVV	
5	@JsGIH"H*G(	HH 
G7-	H'H'	H:HH	G%$G%(	G41H3G44H7	HHHHH	H	I/I

IIIcvtjd|||s\t|rQtjj|r2t
tdr!tjtj}}nyttj}}||}||tj|jy)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)rJrr}rGrmr|rllstatrrychmodrnS_IMODEr)rrrsr	stat_func
chmod_funcrs      r(rr&sxIIc*ws|s0C2x $&HHbiizI %rxx:		3BsDLL,-r'	listxattrc*	tj||}|D]4}	tj|||}tj||||6y#t$rF}|jtjtj
tjfvrYd}~yd}~wwxYw#t$rd}|jtjtjtj
tjtjfvrYd}~d}~wwxYw)zCopy extended filesystem attributes from `src` to `dst`.

        Overwrite existing attributes.

        If `follow_symlinks` is false, symlinks won't be followed.

        r~N)rGrr7r;r=ENODATAr<getxattrsetxattrEPERMEACCES)rrrsrnamesrr8values       r(
_copyxattrr<s	LLoFE
	D
COCuoN			wwu}}emmU\\JJ	
775;;

u}}#(<<#???
s/A1B%	B"<BB"%	D.AD

Dcyrvr&)argskwargss  r(rrTr'c	tjd||dddd	|xs-t|xrtjj|}|r	fd}n	fd}t
|tjr|j|}n|d||}tj|j}|d	||j|jf|t|||	|d
|||t|dr	|d||j |yy#t$rY5wxYw#t"$rB}d
D]2}tt$|s|j$t't$|k(s2nYd}~yd}~wwxYw)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)nsrcyrvr&)rrrs   r(_nopzcopystat.<locals>._noperr'c&tt|Srv)getattrrG)r8rs r(lookupzcopystat.<locals>.lookupls2tT**r'cRtt|}|tjvr|SSrv)rrGsupports_follow_symlinks)r8rxrs  r(rzcopystat.<locals>.lookupqs)T4(BR000	Kr'r~rnutimerst_flagschflags)
EOPNOTSUPPr=)rJrr}rGrmr|rjrkrnrrst_atime_nsst_mtime_nsrNotImplementedErrorrlrr7r;r)
rrrsrfollowrrmodewhyrCrs
         @r(rrWsiIIc*T

JWS\%IbggnnS6I JF
	+
	#r{{#
XXfX
-
VF^C
8<<

#DF7OCR^^R^^< sC0

wT6:r:	F9c2;;G
	

	.
5#&399s8K+K
	s60D+D:+	D76D7:	FFF7FFctjj|r=tjj|tjj	|}t|||t
||||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.

    r~)rGrmisdirjoinbasenamer
r)rrrsrs   r(r
r
sT
ww}}Sggll3 0 0 56S#7S#7Jr'ctjj|r=tjj|tjj	|}ttdritj|}tj|}tj}|s|tjz}	t
j||||St|||t!||||S#t$rI}|jtjk(r|sn|jtjk(rnYd}~kd}~wwxYw)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".
    	CopyFile2Nr~)rGrmrrrrl_winapifsdecode%COPY_FILE_ALLOW_DECRYPTED_DESTINATIONCOPY_FILE_COPY_SYMLINKrr7winerrorERROR_PRIVILEGE_NOT_HELDERROR_ACCESS_DENIEDr
r)rrrsrsrc_dst_r@excs       r(rrs
ww}}Sggll3 0 0 56w${{3{{3==W333E	dD%0J
S#7S#7J	 @ @@'!<!<<	s=C44	E=?EEcfd}|S)zFunction that can be used as copytree() ignore parameter.

    Patterns is a sequence of glob-style patterns
    that are used to exclude filescvg}D]'}|jtj||)t|Srv)extendfnmatchfilterset)rmr
ignored_namespatternpatternss    r(_ignore_patternsz)ignore_patterns.<locals>._ignore_patternss=
	AG  w!?@	A=!!r'r&)rrs` r(rrs
"
r'c
h|5|tj||Dcgc]}|jc}}	n
t}	tj||g}
|t
uxs|tu}|D]|}|j|	vrtjj||j}
tjj||j}|r|n|
}	|j}|rDtjdk(r1|jd}|jtjk(rd}|rtj|
}|r&tj||t|||nztjj!|s|r&|j#rt%|||||||n5|||n+|j#rt%|||||||n	|||	t|||
rt'|
|Scc}w#t&$r)}|
j)|j*dYd}~d}~wt,$r(}|
j/|
|t1|fYd}~d}~wwxYw#t,$r4}t3|dd|
j/||t1|fYd}~d}~wwxYw)N)exist_okrFr~rr)rGfspathr8rmakedirsrr
rmrr{rnst_reparse_tagIO_REPARSE_TAG_MOUNT_POINTrrrris_dirrrrrr7appendstrr)entriesrrrssymlinksignore
copy_functionignore_dangling_symlinks
dirs_exist_okxrerrorsuse_srcentrysrcentrysrcnamedstnamesrcobjr{rlinktorCrs                     r(	_copytreersT
ryy~/H1/HI

KKm,
F E)B]d-BL,8==M)'',,sHMM2'',,sHMM2)w&	8!,,.Jbggo!

e
<''4+J+JJ!&JW-JJvw/VW(lK77>>&16N ( (F!.0H!.0&fg6"(FM1=Bfg.M,8Z0c
FmJ{0Ib	'MM#((1+&&	8MM7GSX677	803
D)1MM3SX./0sIH
B6HAH0I4	I1H==I1	I,,I14	J1=*J,,J1c
tjd||tj|5}t	|}dddt|||||||S#1swYxYw)a'Recursively copy a directory tree and return the destination directory.

    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.

    If dirs_exist_ok is false (the default) and `dst` already exists, a
    `FileExistsError` is raised. If `dirs_exist_ok` is true, the copying
    operation will continue if it encounters existing directories, and files
    within the `dst` tree will be overwritten by corresponding files from the
    `src` tree.
    zshutil.copytreeN)rrrrsrrrrr)rJrrGscandirlistr)	rrrsrrrrritrrs	         r(rr!saPIIc*	CCs)W#3"-.F#022sAAst_file_attributesc	tj|}tj|jxs<|j
tjzxr|jtjk(S#t$rYywxYw)NF)
rGrrnS_ISLNKrrFILE_ATTRIBUTE_REPARSE_POINTrrr7)rmrs  r(_rmtree_islinkrRsr	$BLL,K&&)J)JJJ&&$*I*II
L		sA1A44	B?Bc@tjj|Srv)rGrmr|)rms r(rr[sww~~d##r'c:	tj|5}t|}dddD]s}|j}	|jd}|r:|j
s*	|jrtd	t||^	tj|u	tj|y#1swYxYw#t$r$}|tj||g}Yd}~d}~wwxYw#t$rd}YwxYw#t$r-}|tjj||Yd}~d}~wwxYw#t$r#}|tj||Yd}~:d}~wwxYw#t$r"}|tj||Yd}~yd}~wwxYw)NFr~%Cannot call rmtree on a symbolic link)rGrrr7rmris_junctionr{r|_rmtree_unsafeunlinkrmdir)rmonexc
scandir_itrrCentryfullnamers        r(rr_sm
ZZ
	':&G	'
0::	\\%\8F%++-
##%""IJJ	&
8U+
0		(#)0.#
;	'	'
bjj$$	F	
bggnnh4

0bii3//
0#
bhhc""#sCB:CC6"DE$E/:C?C	C3C..C36DD	D="D88D=	E,	E''E,/	F8FFc	tj|5}t|}dddD]m}tj
j
||j}	|jd}|r2	|jd}	tj|	j}|r	tj|jtj|}
d}	tj
j	tj |
rGt#|
||	tj$|
d}tj&|j|n	td|r5tj$|
L	tj*|j|py#1swY~xYw#t$r)}||_|tj||Yd}~yd}~wwxYw#t$r#}|tj||Yd}~d}~wwxYw#t$rd}Y|wxYw#t$r"}|tj&||Yd}~d}~wwxYw#t$r-}|tj
j(||Yd}~#d}~wwxYw#|stj$|
wwxYw#t$r#}|tj||Yd}~d}~wwxYw#t$r#}|tj*||Yd}~d}~wwxYw)NFr~dir_fdTr)rGrrr7r9rmrr8rrnS_ISDIRrrrO_RDONLYrhrH_rmtree_safe_fdcloserr|r)topfdrmrrrrCrrrorig_stdirfddirfd_closeds            r(rrsk
ZZ
	'*:&G	'.077<<ejj1	\\%\8F#jjj?G!\\'//:F
(

BKKF$(ww''%A'x?;HHUO+/LHHUZZ>A#*+1#22
(
0		%**U3Y.0
	'	'
bjj$$"((Hc2	F	0 ';!"((Hc::; 'A!"''..(C@@A((-
.bggx--
.6
0bii3//
0sF,FF,H11G!%2J&AJ	8H"J	I:!KF)$F,,	G5GG!	H
*HH
HH"	I
+IJ	I

J		J"J;J	JJ		J#&	K/K

K	LK<<L)rrc:tjdtdtjd|||rd}n|d}n
|d}nfd	}t
rt
|trtj|}	tj||
}	tj|tj|
}d}	tjj|tj |r=t#|||	tj$|d}tj&||
n	t)d
|stj$|yy|t-d	t/|rt)d
	t1||S#t$r"}|tj||Yd}~yd}~wwxYw#t$r"}|tj||Yd}~yd}~wwxYw#t($r"}|tj&||Yd}~d}~wwxYw#t($r-}|tjj*||Yd}~d}~wwxYw#|stj$|wwxYw#t($r,}|tjj*||Yd}~yd}~wwxYw)aRecursively delete a directory tree.

    If dir_fd is not None, it should be a file descriptor open to a directory;
    path will then be relative to that directory.
    dir_fd may not be implemented on your platform.
    If it is unavailable, using it will raise a NotImplementedError.

    If ignore_errors is set, errors are ignored; otherwise, if onexc or
    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
    the value of exc_info describes the exception. For onexc it is the
    exception instance, and for onerror it is a tuple as returned by
    sys.exc_info().  If ignore_errors is false and both onexc and
    onerror are None, the exception is reraised.

    onerror is deprecated and only remains for backwards compatibility.
    If both onerror and onexc are set, onerror is ignored and onexc is used.
    Nz1onerror argument is deprecated, use onexc instead)
stacklevelz
shutil.rmtreecyrvr&rs r(rzrmtree.<locals>.onexcsr'crvr&rs r(rzrmtree.<locals>.onexcsr'crvr&rs r(rzrmtree.<locals>.onexcsr'c^|\}}}|d}nt|||jf}|||S)N)NNN)type
__traceback__)rfuncrmrexc_infoonerrors     r(rzrmtree.<locals>.onexcs="&dC;/H#Cy#s/@/@@HtT844r'rFTrz#dir_fd unavailable on this platform)warningswarnDeprecationWarningrJr_use_fd_functionsrjbytesrGrrr6rrrmrhrHrr	rr7r|rrr)	rm
ignore_errorsrrrrrCfd	fd_closeds	  `      r(rrs8*

I(Q	8IIotV,		U]		?

5dE";;t$D	hhtF3G	r{{6:BI	ww"6D%0/HHRL $IHHT&15!"IJJ%&KLL	d#EFF$dE**M	"((D#&		"''4%	/"((D#../5"''..$445	"''..$,	s>F(F3?AI.G!.I0H"I%	F0F++F03	G<GG!	H*HIHI	I"I:IIII"%	J."JJctj|}tjjtjjxsdz}tjj|j
|S)aHA basename() variant which first strips the trailing slash, if present.
    Thus we always get the last component of the path, even for directories.

    path: Union[PathLike, str]

    e.g.
    >>> os.path.basename('/bar/foo')
    'foo'
    >>> os.path.basename('/bar/foo/')
    ''
    >>> _basename('/bar/foo/')
    'foo'
    )rGrrmsepaltseprrstrip)rmr%s  r(	_basenamer("sN99T?D
''++-2
.C
77DKK,--r'c>tjd|||}tjj	|ryt||rtj||ytjj|t|}tjj|rtd|z	tj|||S#t$rGtjj|rCtj|}tj||tj|Y|Stjj	|rt!||rtd|d|dt#|sLtj$|tj&s:tj(|r%tj*dk(rt-d|d	|dt/|||d
t1|Y|S|||tj|Y|SwxYw)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.

    zshutil.moveNz$Destination path '%s' already existszCannot move a directory 'z' into itself 'z'.darwinz%Cannot move the non-empty directory 'z ': Lacking write permission to 'T)rr)rJrrGrmrrtrenamerr(rrr7r|rrr
_destinsrc
_is_immutableaccessW_OKlistdirplatformPermissionErrorrr)rrrsrreal_dstrs     r(rr4s4IImS#&H	ww}}SS#
IIc377<<Ys^4
77>>(#>IJJ
		#x ,O+
77>>#[[%FJJvx(IIcN"O!WW]]3
#s#(+S233c"IIc2773

3LLH4%),c'344
S(-"
$3KO
#x(IIcNO+s 3CA)H7CH:HHctjj|}tjj|}|jtjjs|tjjz
}|jtjjs|tjjz
}|j|Srv)rGrmrpendswithr%
startswithrqs  r(r,r,vs
''//#
C
''//#
C<<$rww{{<<$rww{{>>#r'ct|}tjtjg}t	|dxr|j
|vS)Nr)ryrnUF_IMMUTABLESF_IMMUTABLErlr)rrrimmutable_statess   r(r-r-s>	sB))4+<+<=2z"Fr{{6F'FFr'cx|y	ddlm}	||}||dSy#t$rYywxYw#t$rd}Y$wxYw)z"Returns a gid, given a group name.Nr)getgrnamr)grpr<ImportErrorKeyError)r8r<results   r(_get_gidrA^| $ay
+	((99cx|y	ddlm}	||}||dSy#t$rYywxYw#t$rd}Y$wxYw)z"Returns an uid, given a user name.Nr)getpwnamr)pwdrEr>r?)r8rEr@s   r(_get_uidrGrBrCc	.|d}	nDtr|dk(rd}	n6tr|dk(rd}	n(tr|dk(rd}	ntdj	|d	dl}
|rd
|	znd}|dz|z}tjj|}
|
rJtjj|
s+||jd|
|st
j|
||jd
ttfd}|s^|
j|d|	z}|}| tjj||}	|j!||||j#|tjj%|}|S#|j#wxYw)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.
    Nr$gzipgzbzip2bz2xzzCbad value for 'compress', or compression format not supported : {0}r..tarcreating %szCreating tar archivecH|_|_|_|_|Srv)gidgnameuiduname)tarinforRgroupownerrTs r(_set_uid_gidz#_make_tarball.<locals>._set_uid_gids.?GK!GM?GK!GMr'zw|%sr)_ZLIB_SUPPORTED_BZ2_SUPPORTED_LZMA_SUPPORTED
ValueErrorrtarfilerGrmdirnamerinforrGrArraddr	rp)	base_namebase_dircompressverbosedry_runrXrWloggerroot_dirtar_compressionr_compress_extarchive_namearchive_dirrYtararcnamerRrTs     ``          @@r(
_make_tarballrpsr 	X/	H/	X-++16(+;=	=,43("Lv%4L''//,/K277>>+6KK
{3KK$*+
5/C
5/Cll</)ABww||Hh7H	GGHglG;IIKww|4	
IIKs;FFcddl}|dz}	tjj|}
|
rJtjj	|
s+||jd|
|stj|
||jd|	||sH|j|	d|j5}tjj|}| tjj||}tjj|}|tjk7r&|j||||jd|tj|D]n\}
}}|
}| tjj||}tjj|}t|D]i}tjj|
|}tjj||}|j|||X|jd|k|D]}tjj|
|}tjj|}tjj!|sbtjj||}|j||||jd|q	ddd|tjj#|	}	|	S#1swY,xYw)	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.ziprPz#creating '%s' and adding '%s' to itw)compressionzadding '%s')zipfilerGrmr`rrarZipFileZIP_DEFLATEDnormpathrcurdirrXwalkrelpathsortedisfilerp)rcrdrfrgrhrXrWriruzip_filenamermzfrodirpathdirnames	filenames
arcdirpathr8rms                   r(
_make_zipfilersmv%L''//),K277>>+6KK
{3KK$
9 (	,
__\3)0)=)=?	=BDgg&&x0G#77<<(;ww''1H"))#7+%KK
x8020A
=,9$
'!#X!FJWW--j9
"8,9D77<<6D ggll:t<GHHT7+)M489&=D77<<6D77++D1Dww~~d+"$'',,z4"@w/!-"KK
t<=
=	=<ww|4A	=	=s +EK8A7K84K85K88Lrn)reNzuncompressed tar file)rerIzgzip'ed tar-filegztarzZIP filezip)rerKzbzip2'ed tar-filebztar)rerMzxz'ed tar-filexztarctjDcgc]\}}||df}}}|j|Scc}}w)zReturns a list of supported formats for archiving and unarchiving.

    Each element of the returned sequence is a tuple (name, description)
    r)_ARCHIVE_FORMATSitemssort)r8registryformatss   r(rr@sF %%')~tXhqk")G)LLNN)s>c|g}t|std|zt|ttfstd|D]1}t|ttfrt|dk7s(td|||ft|<y)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	TypeErrorrjtuplerlenr)r8function
extra_argsdescriptionelements     r(rrJs
H7(BCCj5$-0;<<K'E4=1S\A5EIJJK'
K@Tr'ct|=yrv)rr8s r(rr_s
r'c	htjd||||	t|}	||||d}
|	d}|	dD]
\}}
|
|
|<|t
j}t|dd}d}|tj|j}tj|sttjd	||rtj|}||
d
<n^tj}||j!d|t
j"j%|}|stj&|	|||fi|
}|)||j!d|tj&||S#t$rt	d|zdwxYw#|*||j!d|tj&|wwxYw)
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_archivezunknown archive format '%s'N)rgrhrXrWrsupports_root_dirFzNot a directoryrizchanging into '%s'zchanging back to '%s')rJrrr?r^rGryrrnrrNotADirectoryErrorr;ENOTDIRrgetcwddebugrmrpchdir)rcrrirdrfrgrXrWrhformat_inforrargvalrsave_cwdstmdr9s                  r(rrbs$II#Y(KK&v.!Fu.Fq>DNSs99&95AHwwx ((||D!$U]]4ExPP		),I!)F:yy{H!18<	2I"	86v6!4h?HHXOQK6?@dJKF!4h?HHX s	E'0
F'F.F1ctjDcgc]\}}||d|df}}}|j|Scc}}w)zReturns a list of supported formats for unpacking.

    Each element of the returned sequence is a tuple
    (name, extensions, description)
    r)_UNPACK_FORMATSrr)r8rars   r(rrsL$$&(JD$d1gtAw'(G(LLNN(sAci}tjD]\}}|dD]}|||<	|D]}||vsd}t||||fzt|st	dy)z+Checks what gets registered as an unpacker.rz!%s is already registered for "%s"z*The registered function must be a callableN)rrr1rr)	
extensionsrrexisting_extensionsr8raext	extensionmsgs	         r(_check_unpack_optionsrs%++-,
d7	,C'+$	,, H	++5Cy':9'E'G!GH
HHHDEEr'c@|g}t|||||||ft|<y)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)rr)r8rrrrs     r(rrs."
*h
;&*kIODr'ct|=y)z*Removes the pack format from the registry.N)rrs r(rrs
r'ctjj|}tjj|stj|yy)z1Ensure that the parent directory of `path` existsN)rGrmr`rr)rmr`s  r(_ensure_directoryrs5ggood#G
77==!
G"r'cnddl}|j|std|z|j|}	|j	D]}|j
}|j
dsd|vr%tjj|g|jd}|sWt||jdrt|j|d5}t|d5}t||dddddd	|jy#1swY%xYw#1swYxYw#|jwxYw)z+Unpack zip `filename` to `extract_dir`
    rNz%s is not a zip file/z..rr)ru
is_zipfiler/rvinfolistr9r6rGrmrsplitrr5rr	r	)	r9extract_dirrurrar8
targetpathsourcetargets	         r(_unpack_zipfilersh'.9::
//(
#CLLN	0D==Ds#tt|kDDJJsODJj)==%XXdC(0FZ.028/000	0$				0000			sBBD":D"
D
D
&D.
D"
DDD	D""D4rZcddl}	|j|}	|j	|||jy#|j$rtd|zwxYw#|jwxYw)zAUnpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir`
    rNz/%s is not a compressed or uncompressed tar filerZ)r_rTarErrorr/
extractallr	)r9rrr_tarobjs     r(_unpack_tarfilersxJh'+f5
J=HJ	JJ	s<AAA/rOrr)rnrz.tar.gzz.tgzz.tar.bz2z.tbz2z.tar.xzz.txzc~tjD]&\}}|dD]}|j|s|ccS(y)Nr)rrr5)r9r8rars    r(_find_unpack_formatr!sI%++-
da	I  +	r'ctjd||||tj}tj|}tj|}|i}nd|i}|(	t
|}|d}|||fit|d|yt|}|tdj|t
|d}tt
|d|z}|||fi|y#t$rtdj|dwxYw)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.

    If `filter` is given, it is passed to the underlying
    extraction function.
    zshutil.unpack_archiveNrzUnknown unpack format '{0}'rrzUnknown archive format '{0}')rJrrGrrrr?r^rdictrr/)r9rrr
filter_kwargsrrrs        r(rr(s"$II%xfEiik))K(Kyy"H
~
!6*

	U)&1K1~X{Ld;q>&:LmL%X.>:AA(KLLv&q)of-a01MAX{-f-	U:AA&IJPTT	Us%	C""%Dstatvfs
disk_usageusageztotal used freezTotal space in byteszUsed space in byteszFree space in bytesctj|}|j|jz}|j|jz}|j|j
z
|jz}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.
        )rGrf_bavailf_frsizef_blocksf_bfree_ntuple_diskusage)rmrfreetotaluseds     r(rras`ZZ
{{R[[(bkk)bjj(BKK7 d33r'cVtj|\}}||z
}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.
        )r
_getdiskusager)rmrrrs    r(rrrs0&&t,tt| d33r'cxtjd||||
|td|}|}|d}n7t|tr't|}|t
dj||d}n7t|ts't|}|t
dj|tj|||y)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})rJrr^rjrrGLookupErrorrintrArGr)rmuserrW_user_groups     r(rr}sIIndD%0|
899E
F|	D#	=299$?@@}
s
#%>3::5ABBHHT5&!r'c6	ttjd}	ttjd}|dks|dkrb	tj
tjj}|dkr|jxs|d}|dkr|jxs|d}tj||fS#ttf$rd}YwxYw#ttf$rd}YwxYw#tttf$rtj|}YwxYw)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.
    COLUMNSrLINESr)rrGenvironr?r^r rJ
__stdout__r5AttributeErrorr7
terminal_sizecolumnslines)fallbackrrsizes    r(r r s(bjj+,BJJw'(
!|uz	.''(=(=(?@D
a<ll1hqkGA:JJ-(1+E
We,--+
j!

j!
G4	.##H-D	.s4B>C1C,>CCC)(C),)DDctjj|xr8tj||xr tjj	|Srv)rGrmrr.r)rxrs  r(
_access_checkrsAGGNN2
&299R#6
&GGMM"%%'r'c~|tjzxs(tjtj|S)z
    On Windows, we can use NeedCurrentDirectoryForExePath to figure out
    if we should add the cwd to PATH when searching for executables if
    the mode is executable.
    )rGX_OKrNeedCurrentDirectoryForExePathr)cmdrs  r(_win_path_needs_curdirrs5 "W%K%KC &""r'c@t|t}tjj	|\}}|r|g}n|8tj
j
dd}|	tjd}|sy|rHtj|}|j	tjtj}n4tj|}|j	tj}tjdk(rEt!||r9tj"}|rtj|}|j%d|tjdk(rtj&dxst(}|j	tjDcgc]}|s|	}}|r"|Dcgc]}tj|}}|g|Dcgc]}||z	c}z}	n|g}	t+}
|D]p}tjj-|}||
vs'|
j/||	D]4}
tjj1||
}t3||s0|ccSry#ttf$rtj}YwxYwcc}wcc}wcc}w)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_PATHrrPATHEXT)rjrrGrmrrgetconfstrrr^defpathfsencodepathseprrJr1rryinsertgetenv_WIN_DEFAULT_PATHEXTrrorbrr)rrrm	use_bytesr`rypathext_sourcerpathextfilesseendirnormdirthefiler8s               r(rrs!3&I
77==%LGSy<::>>&$/D|&::i0D;;t$D::bkk"**56D;;t$D::bjj)D<<7"'=c4'HYYFV,KK6"
||w9-E1E"0"6"6rzz"BJ3c3JJ3:;Cr{{3';G;g6ss665D ''""3'$HHW 
 ww||C1 t,K
 	 a'
3&::D&6K<7s*I+J&J2JJ+J
J)r)F)FN)rIrrNNNN)rrNNNN)Nr$)NNrrNNN)NN))P)ir+rGrJrnrcollectionsr;rzlibr[r>rLr\lzmar]r8rrrr1rrcrlr6rNrr__all__r7rr!rrr/r6r1r3rDrUrar	rtryr}r
rrrr
rrrrstat_resultrrrrrrsupports_dir_fdrsupports_fdrrravoids_symlink_attacksr(rr,r-rArGrprrrrrrrrrrrrrrrrrr
namedtuplerrrrrrr rrF_OKrrr&r'r(<module>rs<

ONO77d?
77g

<<7G&{I2z*Os||/F/Fw/O775,7?	G	@E@;w;6600&I&	
 (>@.:(4$ER+/>@+/.*2{040
+/@D'+$(,&P
7<@D!&d%&+5.2`2>>/0$!#H60pggrww		288<''(<ZZ2>>1<WW ; ;;
\+T$\+@!2.$"'@DG
$$LM@DDL;<@D7r#'
"&

m01%'
!.1E0F 2!4W,b*=U!.1F0G 3!5W!.1C0D 0!2WA*KL;?=@	F$CG')J,<6:(h-D
EhZ
8
!*F 3_b 2 4OG!+W 5 3 5OG!*F 3_b 0 2OG..d..b2yNN< ...w8IJ&<#%:"%:"
4NN< ...w8IJ4"@+.b'
"GGbgg%DHU.ONOs3NNNNNNNN('N(