ew6SrSSKrSSKrSSKrSSKrSSKrSSKrSSKrCSrSSK r C Sr SSK r C Sr \RS:HrS=rr\RS:XaSSKrO \(aSSKr\R$S:XaSSKrOSr\(aSOS r\"\S 5=(a \R$R-S 5q\=(a \"\S 5rS r/SQr"SS\5r"SS\5r"SS\5r"SS\5r"SS\5r "SS\!5r""SS\!5r#Sr$Sr%\4Sjr&SsS jr'S!r(S"r)S#r*SS$.S%jr+SS$.S&jr,\"\S'5(aSS$.S(jr-OS)r-SS$.S*jr.SS$.S+jr/SS$.S,jr0S-r1StS.jr2SS\0SS4S/jr3\"\RhS05(aS1r5OS2r5S3r6S4r7\Rp\R\Rr\Rt1\Rv:*=(a9 \Rx\Rz;=(a \R\R|;r?SuSSS5.S6jjr@\?\@lAS7rB\04S8jrCS9rDS:rES;rFS<rGSvS=jrHSwS>jrIS\HlJS\IlJS?\HS@/SA40rK\(a\HSB/SC4\KSD'\I/SE4\KSF'\ (a \HSG/SH4\KSI'\ (a \HSJ/SK4\KSL'SMrLSxSNjrMSOrNSySPjrOSQrPSRrQSxSSjrRSTrSSUrTSVrUSSW.SXjrVSY/\V/SA4SZ/\U/SE4S[.rW\(a S\S]/\V/SC4\WSD'\ (a S^S_/\V/SH4\WSI'\ (a S`Sa/\V/SK4\WSL'SbrXSzSSW.ScjjrY\"\Sd5(a[\RSe5 \R"SfSg5r\Sh\\RlSi\\RlSj\\RlSkr`O.\(a'\RSe5 \R"SfSg5r\Slr`SzSSSm.SnjjraS{SojrbSprcSqrd\R\R-S4Srjrgg!\ a SrGNf=f!\ a Sr GNf=f!\ a Sr GNf=f)|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. NTFntposixwin32iisendfile)linuxandroid _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\rSrSrSrg)rCN)__name__ __module__ __qualname____firstlineno____static_attributes__r%,/opt/imh/python3.13/lib/python3.13/shutil.pyrrCsr+rc\rSrSrSrSrg)r"Fz5Raised when source and destination are the same file.r%Nr&r'r(r)__doc__r*r%r+r,r"r"Fs?r+r"c\rSrSrSrSrg)rIzxRaised when trying to do a kind of operation (e.g. copying) which is not supported on a special file (e.g. a named pipe)r%Nr/r%r+r,rrIs;r+rc\rSrSrSrSrg)rMz+Raised when a command could not be executedr%Nr/r%r+r,rrMs5r+rc\rSrSrSrSrg) ReadErrorPz%Raised when an archive cannot be readr%Nr/r%r+r,r6r6Ps/r+r6c\rSrSrSrSrg) RegistryErrorSzRRaised when a registry operation with the archiving and unpacking registries failsr%Nr/r%r+r,r9r9Ss&r+r9c\rSrSrSrSrg)_GiveupOnFastCopyWzmRaised as a signal to fallback on using raw read()/write() file copy when fast-copy functions fail to do so. r%Nr/r%r+r,r<r<Wsr+r<cUR5nUR5n[R"X4U5 g![an[U5eSnAff=f![ acnUR UlUR UlUR[R[R1;a [U5eUSeSnAff=f)z`Copy a regular file content or metadata by using high-performance fcopyfile(3) syscall (macOS). N) fileno Exceptionr<rr OSErrornamefilename filename2errnoEINVALENOTSUP)fsrcfdstflagsinfdoutfderrs r,_fastcopy_fcopyfilerN\s%{{}   e, %$$%  yy   99u}}5 5#C( (4   s- ;A A AA C"ACCcUR5nUR5n[[R "U5R S5n[RS:a [US5nSn[R"X2Xe5nUS:XagXg- nM%![an[U5eSnAff=f![a SnNsf=f![anURUl URUlUR[R :Xa Sq[U5eUR[R$:XaUSeUS:Xa5[R&"US[R(5S:Xa [U5eUeSnAff=f)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_sizerAsysmaxsizeminrrBrCrDrEENOTSOCK_USE_CP_SENDFILEENOSPClseekSEEK_CUR)rHrIrKrLrM blocksizeoffsetsents r,_fastcopy_sendfiler_psP%{{} ..8  {{W 7+ F  ;;uF>D,qy NF5 % %$$%   99CL IICMyyENN*$) ',,yyELL(t#{rxxq"++>!C',,I' sA B*B21C B/ B**B/2 CC E>B+E99E>c URnURn[[U55nU"U5nU(dO&Xb:aUSUnU"U5 SSS5 O U"U5 M6SSS5 g!,(df  N"=f!,(df  g=f)zreadinto()/memoryview() based variant of copyfileobj(). *fsrc* must support readinto() method and both files must be open in binary mode. N)readintowrite memoryview bytearray)rHrIlength fsrc_readinto fdst_writemvnsmvs r,_copyfileobj_readintorks| MMMJ If% &"b!AVssO2 ' & V ' &s#A? A.A?. A< 8A?? B cU(d[nURnURnU"U5=n(aU"U5 U"U5=n(aMgg)z=copy data from file-like object fsrc to file-like object fdstN) COPY_BUFSIZEreadrb)rHrIre fsrc_readrgbufs r,r r sH  IJ6" "# "36" "# " "r+c[U[R5(ab[[RS5(aC[RR UR 5[R "U55$[[RS5(a [RRX5$[RR[RRU55[RR[RRU55:H$![a gf=f![a gf=f)NsamestatFsamefile) isinstancerQDirEntryhasattrpathrrstatrArsnormcaseabspathsrcdsts r, _samefiler~s#r{{##(D(D 77##CHHJ = =rww ## 77##C- - GG  RWW__S1 2 GG  RWW__S1 2 34     s%AD:"E : EE EEc[U[R5(aUR5$[R"U5$N)rtrQrurxfns r,_statrs+"2r{{332779DDr+c[U[R5(aUR5$[RR U5$r)rtrQru is_symlinkrwislinkrs r,_islinkrs0(R[[992==?Qrww~~b?QQr+follow_symlinksc B[R"SX5 [X5(a[SR X55eSn[ X/5HupE[ U5n[R"UR5(a;[U[R5(a UROUn[SU-5e[(aUS:XaUR nMMM U(d=[%U5(a-[R&"[R("U5U5 U$[+US5n[+US5n[,(a/[/Xx[0R25 UsSSS5 sSSS5 $[6(a [9Xx5 UsSSS5 sSSS5 $[(a4US:a.[;Xx[=U[>55 UsSSS5 sSSS5 $[AXx5 SSS5 SSS5 U$!["a GMf=f![4a N;f=f![4a NKf=f!,(df  NJ=f![Ba9n [RREU5(d[GSU35U eeSn A ff=f!,(df  U$=f) 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: )$rTauditr~r"format enumeraterrxS_ISFIFOst_modertrQrurwr_WINDOWSrSrArsymlinkreadlinkopen_HAS_FCOPYFILErNr_COPYFILE_DATAr<rXr_rkrVrmr IsADirectoryErrorexistsFileNotFoundError) r|r}r file_sizeirstrHrIes r,r r s-II*=DDSNOOIC:& 'rB }}RZZ(( *2r{{ ; ;RWW&'='BCCxAFJJ #x' ws|| 2;;s#S)D JA#t_ #t_%~!/E.chmod_func8s$55r+)rTrrrQrwrrvlstatrrrBrrxS_IMODEr)r|r}r stat_funcrrs r,r r &sII* ws||s0C0C 2x $&HHbiiz  77d?rww~~c22 6J 3BsDLL,-r+ listxattrc([R"XS9nUH.n[R"XUS9n[R"XXbS9 M0 g![aHnUR[R[R [R 4;aeSnAgSnAff=f![agnUR[R[R[R [R [R4;aeSnAMSnAff=f)zCopy extended filesystem attributes from `src` to `dst`. Overwrite existing attributes. If `follow_symlinks` is false, symlinks won't be followed. rN) rQrrArErGENODATArFgetxattrsetxattrEPERMEACCES)r|r}rnamesrrBvalues r, _copyxattrrAs LLFE D  CO CuN  wwu}}emmU\\JJ   775;; u}}#(<<#??? s/A *B  B>BB D*AD  Dcgrr%)rkwargss r,rrY r+c8^ [R"SX5 SSS.Sjm U=(d6 [U5=(a [RR U5(+nU(aU 4SjnOU 4Sjn[ U[R5(aURUS9nO U"S5"XS9n[R"UR5nU"S 5"XRUR4US9 [XUS9 U"S 5"XUS9 [US 5(aU"S 5"XR US9 gg![a N7f=f!["aJnS H>n[[$U5(dMUR$['[$U5:XdM: SnAg eSnAff=f)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)nsrcgrr%)rrrs r,_nopcopystat.._nopjrr+c&>[[UT5$r)getattrrQ)rBrs r,lookupcopystat..lookupqs2tT* *r+cV>[[UT5nU[R;aU$T$r)rrQsupports_follow_symlinks)rBrrs r,rrvs)T4(BR000 Kr+rrxutimerst_flagschflags) EOPNOTSUPPrG)rTrrrQrwrrtrurxrr st_atime_ns st_mtime_nsrNotImplementedErrorrvrrArEr) r|r}rfollowrrmodewhyrMrs @r,r r \sTII*T  JWS\%IbggnnS6I JF  +   #r{{## XXfX - F^C 8 << #D 7OC^^R^^< s0  w6:r:  9 c;; G       .5#&&399s8K+K/  s<= D5E5 EE FF+F FFFc[RRU5(a=[RRU[RR U55n[ XUS9 [ XUS9 U$)aCopy 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)rQrwisdirjoinbasenamer r )r|r}rs r,rrsS ww}}Sggll3 0 0 56 S7 S7 Jr+c[RRU5(a=[RRU[RR U55n[ [ S5(ap[R"U5n[R"U5n[ RnU(dU[ R-n[ R"X4U5 U$[XUS9 [!XUS9 U$![aSnUR[ R:Xa U(dSnANJUR[ R:XaSnANmeSnAff=f)aCopy 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)rQrwrrrrv_winapifsdecode%COPY_FILE_ALLOW_DECRYPTED_DESTINATIONCOPY_FILE_COPY_SYMLINKrrAwinerrorERROR_PRIVILEGE_NOT_HELDERROR_ACCESS_DENIEDr r )r|r}rsrc_dst_rJexcs r,rrs ww}}Sggll3 0 0 56w $${{3{{3== W33 3E    d% 0J S7 S7 J   @ @@'!/nTH(nUR[R"X55 M* [U5$r)extendfnmatchfilterset)rwr ignored_namespatternpatternss r,_ignore_patterns)ignore_patterns.._ignore_patternss4 G  !? @ =!!r+r%)rrs` r,rrs " r+c Ub8U"[R"U5UVs/sHoRPM sn5n OSn [R"X'S9 /n U[L=(d U[ Ln UGHn U RU ;aM[R RXR5n [R RX,R5nU (aU OU nU R5nU(aC[RS:Xa/U RSS9nUR[R:XaSnU(a[R"U 5nU(a)[R"UU5 [XU(+S9 GM RU5(d U(aGMIU R!5(a[#XX4XVU5 GMoU"X5 GMzU R!5(a[#XX4UXg5 GMU"X5 GM [X5 U (a [%U 5eU$s snf![$a*nU R'UR(S5 SnAGMSnAf[*a(nU R-X[/U545 SnAGM1SnAff=f![*a4n[1USS5cU R-X[/U545 SnANSnAff=f)Nr%)exist_okrFrrr)rQfspathrBmakedirsrrrwrrrxst_reparse_tagIO_REPARSE_TAG_MOUNT_POINTrrr ris_dirrrrrrAappendstrr)entriesr|r}symlinksignore copy_functionignore_dangling_symlinks dirs_exist_okxrerrors use_srcentrysrcentrysrcnamedstnamesrcobjrrlinktorMrs r, _copytreers8 ryy~/H1/HI  KK, F E)B]d-BL ==M ) '',,sMM2'',,sMM2)w& 8!,,.Jbggo! e <''4+J+JJ!&JW-JJvw/V(lK77>>&116N (( (!.!.0&f6""(M1Bf.MZ0 Fm J{0Ib ' MM#((1+ & & 8 MM7SX6 7 7 8 0 3 D ) 1 MM3SX. /0s`H: !B$H?+H?6#H?H?'#H? H? J&? J# I.. J#;JJ#& K$0*KK$c [R"SX5 [R"U5n[ U5nSSS5 [ WXUX4UUS9$!,(df  N=f)aRecursively 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 to 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)rr|r}rrrrr)rTrrQscandirlistr) r|r}rrrrritrrs r,rr&sSPII* CCs)  W#".F#0 22 s A Ast_file_attributesc[R"UR5=(dA UR[R-=(a UR [R :H$r)rxS_ISLNKrrFILE_ATTRIBUTE_REPARSE_POINTrrrs r,_rmtree_islinkrWsL RZZ(J  " "T%F%F FI%%)H)HH Kr+cB[R"UR5$r)rxrrrs r,rr\s||BJJ''r+c^U4Sjn[R"USU[RS9nUHupEnUH9n[RR XG5n[R "U5 M; UH9n[RR XG5n[R"U5 M; M [R "U5 g![ a M[a"n T"[R X5 Sn A MSn A ff=f![ a M[a"n T"[RX5 Sn A MSn A ff=f![ a g[a!n T"[R X 5 Sn A gSn A ff=f)Ncv>[U[5(d#T"[RURU5 ggr)rtrrQrrC)rMonexcs r,onerror_rmtree_unsafe..onerroras*#011 "**cllC 02r+F)topdownr  followlinks) rQwalk_walk_symlinks_as_filesrwrrmdirrrAunlink) rwr r resultsdirpathdirnames filenamesrBfullnamerMs ` r,_rmtree_unsafer`s'1ggdE7HbHbcG(/$9Dww||G2H /"Dww||G2H 0 (#)0"# %  /bhh.. / %  0bii// 0   # bhh""#sZCD 8E D D%DD E E D==E E; E;E66E;cUR5up#pEUcUO URnU[RLa[R"U5 gU[RLa[R"XcS9 gU[R LdeUc[R "XcS9nOUR SS9n[Rn[R"U[R[R-US9n[RRn[RRU[R"U55(d [S5eUR[RX4U45 UR[RXU45 [R n[R "U5n [#U 5n SSS5 W Hn [RR%XKR5n U R'SS9(a$UR[R XU 45 Me[R*"U RUS9 M g!UR[RXU45 f=f!,(df  N=f![(a M[a Nuf=f![(a M[a#n U"[R*X5 Sn A GMSn A ff=f![(a4n UbU[RLaXMlU"X$U 5 Sn A gSn A gSn A f[an XMlU"X$U 5 Sn A gSn A ff=f)N)dir_fdFr%Cannot call rmtree on a symbolic link)poprBrQcloserrrxrO_RDONLY O_NONBLOCKrwrrrrRrArrrrrrrrC)stackr funcdirfdrw orig_entryrBorig_sttopfd scandir_itrentryrrMs r,_rmtree_safe_fdr*~s{%*IIK!D%4:??D6 288  HHUO  288  HHT ( rxx  hht2G ooeo77##GRXXe_==EFF LL"((E< = LL"((E< =zz ZZ *:&GEww||D**5H <<<6LL"((EU!CD7 0 %**U3 LL"((E< = %   %  0bii// 0 #  !1L $c " ""2   d#s)K3'K38BK3A&I#:AK3 J 6K36J;K3?J7K3#$JK3 JK3 J4%K3( J41K33J44K37 K0K3 K0 K+$K3+K00K33 M=%L,, M9M  M)r rc^[R"SX5 U(aSnOTcUcSnOUc TcSnOU4Sjn[(a[U[5(a[ R "U5n[ RX@S4/nU(a[XS5 U(aMU(aIUR5upgpU[ RLaM/[ R"U5 U(aMHggUb [S5e[ R"U5n [U 5(a [S5e[!X5$![a!n U"[ RX 5 Sn A N~Sn A ff=f!U(axUR5upgpU[ RLaM/[ R"U5 O.![a!n U"[ RX 5 Sn A OSn A ff=fU(aMwff=f![a!n U"[ RX 5 Sn A gSn A ff=f![a+n U"[ RRX 5 Sn A gSn A ff=f) 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. z shutil.rmtreecgrr%rs r,r rmtree..onexcs r+Ncerr%rs r,r r-s r+cerr%rs r,r r-sr+cZ>UupnUcSnO[U5X3R4nT"XU5$)N)NNN)type __traceback__)rr#rwrexc_infor s r,r r-s7"&C;/H#Cy#/@/@@Ht844r+z#dir_fd unavailable on this platformr)rTr_use_fd_functionsrtbytesrQrrr*rrrArrrwrr) rw ignore_errorsr r rr"r#fdr)rMrs ` r,rrs*IIot,  U]   ?  5 dE " ";;t$D((F$/0 /-%(- %$rxx'/HHRL %  %&KL L $B b!!EFF"d**%/"((D../ (- %$rxx'/HHRL/"((D../ %  "((D &    "''..$ ,  s E0EG4H" E- E((E-00G1!F87G18 G#GG1G## G1/G14 H>HH" I,!IIc[R"U5n[RR[RR=(d S-n[RR UR U55$)a A 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' )rQrrwsepaltseprrstrip)rwr:s r, _basenamer=sN 99T?D ''++-2 .C 77  DKK, --r+c[R"SX5 Un[RR U5(a[ X5(a;[RR U5(d[R"X5 g[RRU[U55n[RRU5(a[SU-5e[R"X5 U$![Gai [RR U5(aE[R"U5n[R"XC5 [R"U5 U$[RR U5(a[!X5(a[SU<SU<S35e[#U5(dY[R$"U[R&5(dC[R("U5(a([R*S:Xa[-SU<S U<S35e[/XUS S 9 [1U5 U$U"X5 [R"U5 U$f=f) aRecursively move a file or directory to another location. This is similar to the Unix "mv" command. Return the file or directory's destination. If dst is an existing directory or a symlink to a directory, then src is moved inside that directory. The destination path in that directory must not already exist. If dst 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 existszCannot move a directory 'z' into itself 'z'.darwinz%Cannot move the non-empty directory 'z ': Lacking write permission to 'T)rr)rTrrQrwrr~rrenamerr=rrrArrr _destinsrc _is_immutableaccessW_OKlistdirplatformPermissionErrorrr)r|r}rreal_dstrs r,rr.s4IImS&H ww}}S S  rww~~c':': IIc  77<<Ys^4 77>>( # #>IJ J # , O+  77>>#  [[%F JJv ( IIcN" O!WW]]3  ###(+S233c""IIc27733 3LLH4%),c'344 S-" $ 3K O # ( IIcN O+s %C==A1I11CI1I10I1c[RRU5n[RRU5nUR[RR5(dU[RR- nUR[RR5(dU[RR- nUR U5$r)rQrwrzendswithr: startswithr{s r,rArAps ''//# C ''//# C << $ $ rww{{ << $ $ rww{{ >># r+c[U5n[R[R/n[ US5=(a UR U;$)Nr)rrx UF_IMMUTABLE SF_IMMUTABLErvr)r|rimmutable_statess r,rBrBys> sB))4+<+<= 2z " Fr{{6F'FFr+cUcgSSKJn U"U5nUbUS$g![a gf=f![a SnN'f=f)z"Returns a gid, given a group name.Nr)getgrnam)grprQ ImportErrorKeyError)rBrQresults r,_get_gidrW~^ | $ay   . ++ ==cUcgSSKJn U"U5nUbUS$g![a gf=f![a SnN'f=f)z"Returns an uid, given a user name.Nr)getpwnamrR)pwdr[rTrU)rBr[rVs r,_get_uidr]rXrYc ^^^^UcSn OV[(a US:XaSn OB[(a US:XaSn O.[(a US:XaSn O[SR U55eS SKn U(aS U -OSn US -U -n [ RRU 5n U (aV[ RRU 5(d2UbURS U 5 U(d[ R"U 5 UbURS 5 [T5m[T5mUUUU4SjnU(d[U RU SU -5nUnUb[ RRX5nUR!UUUS9 UR#5 Ub[ RR%U 5n U $!UR#5 f=f)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. Nr9gzipgzbzip2bz2xzzCbad value for 'compress', or compression format not supported : {0}r..tar creating %szCreating tar archivecL>TbTUlTUlTbTUlTUlU$r)gidgnameuiduname)tarinforhgroupownerrjs r, _set_uid_gid#_make_tarball.._set_uid_gids. ?GK!GM ?GK!GMr+zw|%sr)_ZLIB_SUPPORTED_BZ2_SUPPORTED_LZMA_SUPPORTED ValueErrorrtarfilerQrwdirnamerinforr]rWrraddrrz) base_namebase_dircompressverbosedry_runrnrmloggerroot_dirtar_compressionrv compress_ext archive_name archive_dirrotararcnamerhrjs `` @@r, _make_tarballrs~  X/ H/ X-++16(+;= =,43("Lv% 4L''//,/K277>>+66   KK { 3 KK $ *+ 5/C 5/C ll</)AB  ww||H7H  GGHglG ; IIKww|4  IIKs +F00Gc\SSKnUS-n [RRU5n U (aV[RR U 5(d2UbUR SU 5 U(d[R "U 5 UbUR SX5 U(GdVURU SURS9n [RRU5n Ub[RRXq5n[RRU5nU [R:wa&U RX5 UbUR SU5 [R"U5GH}upnU nUb [RRUU5n[RRU5n[U5Hln[RRU U5n[RRUU5n U RUU 5 UcMZUR SU5 Mn UHn[RRU U5n[RRU5n[RR!U5(dMh[RRUU5n U RUU 5 UcMUR SU5 M GM SSS5 Ub[RR#U 5n U $!,(df  N2=f) 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.ziprfz#creating '%s' and adding '%s' to itw) compressionz adding '%s')zipfilerQrwrwrrxrZipFile ZIP_DEFLATEDnormpathrcurdirrbrrelpathsortedisfilerz)rzr{r}r~rrnrmrr zip_filenamerzfrrrr arcdirpathrBrws r, _make_zipfilersXv%L''//),K277>>+66   KK { 3 KK $  9  ,  __\3)0)=)=?BDgg&&x0G#77<<;ww''1H"))#+%KK x8020A,9$ '!#X!FJWW--j9 "8,D77<<6D ggll:tELADNs #99&95AHwwx ((||D!!$U]]4ExP P  ),I!): yy{H! 18< 2I" 6v6  ! 4h? HHX  OQ K6?@dJKF  ! 4h? HHX  s E< F<F1G c[R5VVs/sHupXSUS4PM nnnUR5 U$s snnf)zReturns a list of supported formats for unpacking. Each element of the returned sequence is a tuple (name, extensions, description) r)_UNPACK_FORMATSrr)rBrxrs r,rrsO$$&(&-7D1gtAw'& ( LLN N(sAc0n[R5HupEUSHnXCU'M M UHnXs;dM Sn[XX74-5e [U5(d [ S5eg)z+Checks what gets registered as an unpacker.rz!%s is already registered for "%s"z*The registered function must be a callableN)rrr9rr) extensionsrrexisting_extensionsrBrxext extensionmsgs r,_check_unpack_optionsrs%++- 7C'+ $.  +5C':'E'G!GH H H  DEE r+c<Uc/n[XU5 XX44[U'g)a!Registers 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)rBrrrrs r,rrs(" * ;&*IODr+c[U g)z*Removes the pack format from the registry.N)rrs r,rrs r+c[RRU5n[RRU5(d[R"U5 gg)z1Ensure that the parent directory of `path` existsN)rQrwrwrr)rwrws r,_ensure_directoryrs8ggood#G 77== ! ! G "r+cSSKnURU5(d[SU-5eURU5nUR 5HnUR nUR S5(dSU;aM-[RR"U/URS5Q76nU(dMf[U5 URS5(aMURUS5n[US5n[Xx5 SSS5 SSS5 M UR5 g!,(df  N+=f!,(df  M=f!UR5 f=f)z+Unpack zip `filename` to `extract_dir` rNz%s is not a zip file/z..rr)r is_zipfiler6rinfolistrCrKrQrwrsplitrrJrr r) rC extract_dirrrrxrB targetpathsourcetargets r,_unpack_zipfilers   h ' '.9:: //( #CLLND==Ds##tt|kDDJJsODJ j )==%%XXdC(FZ.&//)(#$ /.)( sBBEE& D53 D$?D5 E$ D2 .D55 E ?EErqcSSKnURU5nUR XS9 UR 5 g!URa [SU-5ef=f!UR 5 f=f)zAUnpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir` rNz/%s is not a compressed or uncompressed tar filerq)rvrTarErrorr6 extractallr)rCrrrvtarobjs r,_unpack_tarfilersvJh'+5    J = HJ JJ  s8AAA,rer)rrz.tar.gzz.tgzz.tar.bz2z.tbz2z.tar.xzz.txzc[R5H-upUSHnURU5(dMUs s $ M/ g)Nr)rrrJ)rCrBrxrs r,_find_unpack_formatrs@%++- aI  ++ !. r+c [R"SXU5 Uc[R"5n[R"U5n[R"U5nUc0nOSU0nUb'[ UnUSnU"X40[US5DUD6 g[U5nUc[SRU55e[ USn[[ US5U-nU"X40UD6 g![ a [SRU55Sef=f)a1Unpack 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}'rrRzUnknown archive format '{0}') rTrrQrrrrUrurdictrr6)rCrrr filter_kwargsrr#rs r,rr"s$II%xfEiik ))K(Kyy"H ~ !6*   U)&1K1~ XLd;q>&:LmL%X. >:AA(KL Lv&q)of-a01MA X-f- U:AA&IJPT T Us + C''&D statvfs disk_usageusageztotal used freezTotal space in byteszUsed space in byteszFree space in bytesc[R"U5nURUR-nURUR-nURUR - UR-n[ X4U5$)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. )rQrf_bavailf_frsizef_blocksf_bfree_ntuple_diskusage)rwrfreetotaluseds r,rr[s^ ZZ {{R[[( bkk) bjj(BKK7 d33r+cR[R"U5upX- n[XU5$)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)rwrrrs r,rrls* &&t, | d33r+rrc[R"SXU5 UcUc [S5eUnUnUcSnO=[U[5(a([ U5nUc[ SRU55eUcSnO=[U[5(d([U5nUc[ SRU55e[R"XXcUS9 g)aChange 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. If dir_fd is set, it should be an open file descriptor to the directory to be used as the root of *path* if it is relative. If follow_symlinks is set to False and the last element of the path is a symbolic link, chown will modify the link itself and not the file being referenced by the link. z shutil.chownNzuser and/or group must be setzno such user: {!r}zno such group: {!r}r) rTrrurtrr] LookupErrorrintrWrQr)rwuserrmrr_user_groups r,rrwsIInd%0 | 899 E F | D#   =299$?@ @ } s # #% >3::5AB BHHT&,.r+c\[[RS5n[[RS5nUS::dUS::ao[R "[ RR55nUS::aUR=(d USnUS::aUR=(d USn[R"X45$![[4a SnNf=f![[4a SnNf=f![[[4a [R"U5nNf=f)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)rrQenvironrUrur!rT __stdout__r?AttributeErrorrA terminal_sizecolumnslines)fallbackrrsizes r,r!r!s (bjj+,BJJw'( !|uz .''(=(=(?@D a<ll1hqkG A:JJ-(1+E  W, --+ j ! j ! G4 .##H-D .s4C C%2C= C"!C"%C:9C:=+D+*D+c[RRU5=(aA [R"X5=(a$ [RR U5(+$r)rQrwrrCr)rrs r, _access_checkrs? GGNN2  &299R#6 &GGMM"%%'r+cU[R-(+=(d* [R"[R"U55$)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. )rQX_OKrNeedCurrentDirectoryForExePathr)cmdrs r,_win_path_needs_curdirrs5   "W%K%K C &""r+c^[U[5n[RR U5up@U(aU/nGO.Uc:[R R SS5nUc[R"S5nU(dgU(aJ[R"U5nUR [R"[R55nO5[R"U5nUR [R5n[RS:XaO[!X5(a?[R"nU(a[R"U5nUR%SU5 [RS:XGa[R&"S5=(d [(nUR [R5nUVs/sHo(dM UR+S5PM nnU(a&UVs/sHn[R"U5PM nnUVs/sHoU-PM n nUR-5mU[R.-(a[1U4SjU55(aU R%SU5 OU/n [35n UHxn [RR5U 5n X;dM)U R7U 5 U H8n [RR9X5n[;X5(dM4Us s $ Mz g![[4a [RnGNf=fs snfs snfs snf) aGiven 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_PATHrrPATHEXTrdc3b># UH$nTRUR55v M& g7fr)rJupper).0rnormcmds r, which..s'&XPWw'7'7 'D'DPWs,/)rtr5rQrwrrgetconfstrrrudefpathfsencodepathseprrTrFrrinsertgetenv_WIN_DEFAULT_PATHEXTr<r ranyrryryrr)rrrw use_bytesrwrpathext_sourcepathextrfilesseendirnormdirthefilerBr s @r,r r sT3&I 77==%LGy <::>>&$/D|&::i0D ;;t$D::bkk"**56D;;t$D::bjj)D <<7 "'=c'H'HYYFV, KK6 " ||w9-E1E &&rzz2.5=gs?3::c?g= 3:;7Cr{{3'7G;&-.gssg. ))+rww3&XPW&X#X#X LLC  5D''""3'   HHW  ww||C1 ,,K!  q' 3&::D&8><.s*&L L6L68 L;M L32L3)r)F)FN)r_rrNNNN)rrNNNN)Nr9)NNrrNNN)NN))r7)hr0rQrTrxr collectionsrEzlibrrrTrbrslzmartrBrrrrFrrmrvrKrXrr__all__rArr"rrr6r@r9r<rNr_rkr r~rrr r rr rrrrr stat_resultrrr*rrrsupports_dir_fdr supports_fdrr4ravoids_symlink_attacksr=rrArBrWr]rrrrrrrrrrrrrrrrrrr namedtuplerrrrrrr!rrF_OKrr r%r+r,r,sO    O N O 77d? 77g  <<7G&{I B +F //0DE775,7?  G @E@;w;6600&I&   (>@.:(4$ER+/>@+/.4 2{040 +/@D'+$(,&P 7<@D!&d%&+5.2` 2>>/00K (#>1<WW ; ;; L+T$L+`!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..b 2y NN< #..w8IJ&<#%:"%:" 4 NN< #..w8IJ4&.t&.P+.b' "GGbgg%DP[.ONOs3O.O=P .O:9O:=P P  PP