VcuZdZdZdZdZdZdZdZdZdZdd l Z dd l Z dd l Z dd l Z dd l Tgd Z d Z dd lmZmZmZdZn#e$rdZYnwxYwdZdZdZdZdZe jje_dZdZdZ dZ! ddl"m#Z#n #e$rd Z#YnwxYwdZ$dZ%dZ& ddl"m'Z'dZ(n#e$rdZ(YnwxYwd Z) dd!l"m*Z*d"Z+n #e$re)Z+YnwxYw dd#l"m,Z,m-Z.d$Z/d%Z0d&d'd(Z1n #e$re+Z1YnwxYwe2e d)oe j3d*d+kZ4d/d,Z5d-Z6 dd.l"m7Z8d S#e$rYd SwxYw)0zCommon pathname manipulations, WindowsNT/95 version. Instead of importing this module directly, import os and refer to this module as os.path. ...\;/z.;C:\binnulN)*)&normcaseisabsjoin splitdrivesplitsplitextbasenamedirname commonprefixgetsizegetmtimegetatimegetctimeislinkexistslexistsisdirisfileismount expanduser expandvarsnormpathabspathcurdirpardirseppathsepdefpathaltsepextsepdevnullrealpathsupports_unicode_filenamesrelpathsamefile sameopenfilesamestat commonpathc4t|trdSdS)N\/\/) isinstancebytespaths /usr/lib64/python3.11/ntpath.py _get_bothsepsr8#s$vu) LCMapStringExLOCALE_NAME_INVARIANTLCMAP_LOWERCASEctj|}|s|St|trnt j}||ddd}ttt|}| |dSttt|ddS)nNormalize case of pathname. Makes all characters lowercase and all slashes into backslashes. surrogateescaperr) osfspathr3r4sysgetfilesystemencodingdecodereplace_LCMapStringEx_LOCALE_NAME_INVARIANT_LCMAP_LOWERCASEencode)sencodings r7r r 3s IaLL H a   8022H#455==c4HHA5/44A88H&788 8!"8"2"#))C"6"688 8r9c<tj|}t|trLtjtj|ddS|ddS)r>rr)r@rAr3r4fsencodefsdecoderElowerrJs r7r r Fsx IaLL a   J;r{1~~55c4@@FFHHII Iyyd##))+++r9ctj|}t|tr,|dddrdSn+|dddrdSt |d}t|d ko|d o|d t|vS) zTest whether a path is absolute/\\\?\Trr\\?\r) r@rAr3r4rE startswithr lenr8rPs r7r r Ws ! A!U 99T5 ! ! , ,Z 8 8 4  99S$   * *9 5 5 41 aA q66A: ;!A$ ;1Q4=+;+;#;;r9ctj|}t|trd}d}d}nd}d}d} |s |dd|zt |\}}t tj|D]x}t |\}} | r| d|vr |s|s|}| })|r7||kr1||kr|}| }`|}|r|d|vr||z}|| z}y|r"|d|vr|r|dd|kr||z|zS||zS#tttf$rtj d |g|RwxYw) NrSr1:rr2:rr ) r@rAr3r4r maprO TypeErrorAttributeError BytesWarning genericpath_check_arg_types) r6pathsr#sepscolon result_drive result_pathpp_drivep_paths r7r r gs 9T??D$  !HsNN$.t$4$4! kRY&& / /A(mmOGV '&)t+ '+,+#*L$  'W 4 '==??l&8&8&:&::#*L"(K&  0{2d: 0)C/ %.KK  4KN$6 4  4)"##.%7 4#% 3 3k)) ~| 4$VT:E:::: sCDD,EcXtj|}t|dkrt|trd}d}d}nd}d}d}|||}|dd|dzkr|dd |kr||d}|d kr |d d|fS|||d z}||d zkr |d d|fS|d krt|}|d |||d fS|d d|kr|d d|dd fS|d d|fS) aSplit a pathname into drive/UNC sharepoint and relative path specifiers. Returns a 2-tuple (drive_or_unc, path); either part may be empty. If you assign result = splitdrive(p) It is always true that: result[0] + result[1] == p If the path contained a drive letter, drive_or_unc will contain everything up to and including the colon. e.g. splitdrive("c:/dir") returns ("c:", "/dir") If the path contained a UNC path, the drive_or_unc will contain the host name and share up to but not including the fourth directory separator character. e.g. splitdrive("//host/computer/dir") returns ("//host/computer", "/dir") Paths cannot contain both a drive letter and a UNC path. rSrRrZrrr[rr\NrV)r@rArXr3r4rEfind)rhr#r&renormpindexindex2s r7r r st& ! A 1vv{ a   CFEECFE &#&& !A#J#a%  *eAaCjC&7 * JJsA&&E{ !uaxZZUQY//F" !uax| QWfW:qz) ) 1:  RaR5!ABB%<  RaR5!8Or9c4tj|}t|}t|\}}t |}|r!||dz |vr|dz}|r ||dz |v|d|||d}}||p|}||z|fS)z~Split a pathname. Return tuple (head, tail) where tail is everything after the final slash. Either part may be empty.rVN)r@rAr8r rXrstrip)rhrddiheadtails r7rrs ! A   D a==DAq AA !A#d" Q !A#d"2A2!""$D ;;t   $D t8T>r9ctj|}t|trt j|dddSt j|dddS)NrSrR.rrr)r@rAr3r4ra _splitextrhs r7rrsO ! A!U8$QtT:::$Qc3777r9c,t|dS)z)Returns the final component of a pathnamerVrr{s r7rr 88A;r9c,t|dS)z-Returns the directory component of a pathnamerr}r{s r7rrr~r9c tj|}n#tttf$rYdSwxYwt j|jS)zhTest whether a path is a symbolic link. This will always return false for Windows prior to 6.0. F)r@lstatOSError ValueErrorr_statS_ISLNKst_moder6sts r7rrsQ Xd^^ Z 0uu < # ##s 22cb tj|}n#ttf$rYdSwxYwdS)zCTest whether a path exists. Returns True for broken symbolic linksFT)r@rrrrs r7rr sB Xd^^ Z uu 4s ,,)_getvolumepathnamectj|}t|}t|}t |\}}|r|d|vr| p||vS|r||vrdSt ra||}t ||}||kSdS)zaTest whether a path is a mount point (a drive root, the root of a share, or a mounted volume)rTF)r@rAr8r r rrscasefold)r6rdrootrestxys r7rr s 9T??D   D 4==DD!!JD$ ,Q4,+ddl+  t KK   d # # * *4 0 0zz||qzz||++ur9ctj|}t|trd}nd}||s|Sdt |}}||kr9||t |vr"|dz }||kr||t |v"dtjvrtjd}nVdtjvr|S tjd}n#t$rd}YnwxYwt|tjd}|dkr|d|}t|trtj |}tj d}||kr2|t|kr|Stt||}t|trtj|}|||d zS) zLExpand ~ and ~user constructs. If user or $HOME is unknown, do nothing.~~rV USERPROFILEHOMEPATH HOMEDRIVEUSERNAMEN)r@rAr3r4rWrXr8environKeyErrorr rNgetrrrM)r6tilderunuserhomedrive target_user current_users r7rr=s 9T??D$ ??5 ! ! c$iiqA a%DG=#6#66 Q a%DG=#6#66 " 7:m, 2: %7  J{+EE   EEE rz*566Av<1Q3i k5 ) ) 3+k22Kz~~j11 , & < x111  GH--{;;H$);x(( d122h sC C*)C*ctj|}t|trOd|vrd|vr|Sddl}t|j|jzdzd}d}d}d}d }d}ttd d}n6d |vrd |vr|Sddl}|j|jzdz}d }d }d}d}d }tj}|dd} d} t|} | | kr || | dz} | |kre|| dzd}t|} | | } | | |d| dzzz } n#t$r| | |zz } | dz } YnwxYw| |kr|| dz| dz|kr | | z } | dz } n`|| dzd}t|} | |} |d| } |7tj tjtj | }n|| }n#t$r || z|z}YnwxYw| |z } n#t$r| ||zz } | dz } YnwxYw| |kr|| dz| dz|kr | | z } | dz } n}|| dz| dz|kr|| dzd}t|} | |} |d| } |7tj tjtj | }n|| }n#t$r||z| z|z}YnwxYw| |z } n#t$r| ||z|zz } | dz } YnwxYw|dd} | dz } || | dz} | r!| |vr| | z } | dz } || | dz} | r| |v |7tj tjtj | }n|| }n#t$r|| z}YnwxYw| |z } | r| dz} n| | z } | dz } | | k | S)zfExpand shell variables of the forms $var, ${var} and %var%. Unknown variables are left unchanged.$%rNz_-ascii'{}environb$%'{}rVrl)r@rAr3r4string ascii_lettersdigitsgetattrrrXrprrMrNr)r6rvarcharsquotepercentbracerbracedollarrresrppathlencvarvalues r7rrzsU 9T??D$ t  D 0 K - =DgNN"j$// d? s$ K '&-7$>* rr(C E$iiG '/K uQw  :H  #D$iiG $ 1 q4  +++ $ $ $q4x!  $'\? EAIeai'(G3 !q E!GHH~d))! JJw//E vv,C8"1$&K 2;s;K;K0L$M$MEE$+CLE#888 '#  785LCC"(((7T>)C#aKEEE(&[) EAIeai'(F2& q eai )*e3# E!GHH~d))! JJv..E vv,C>"1$&K 2;s;K;K0L$M$MEE$+CLE#>>> & 4v =>5LCC"(((6E>D00C#aKEEE(2A2h uqy).AM.1HCQJEU519_-A.AM.)- " BJr{37G7G,H I I ' )))"SLEEE)u QJE 1HC  W '/KX Jso(D++EE H ,AG..HH H('H(L#AK%%K=<K=L#"L#&AN((N:9N:)_path_normpathctj|}t|tr5tjt tj|pdSt |pdS)0Normalize path, eliminating double slashes, etc.ryr)r@rAr3r4rMrrNr5s r7rr!s\y dE " " J;~bk$.?.?@@AAIT Id##*s*r9ctj|}t|tr d}d}d}d}d}n d}d}d}d }d }||r|S|||}t |\}}||r||z }||}||}d }|t|kr||r |||kr||=n\|||krK|d kr ||d z |kr||d z |d z=|d z}n*|d kr| |r||=n |d z }n|d z }|t|k|s|s| ||| |zS) rrSrRry..)s\\.\rTrrrr)z\\.\rUrrV) r@rAr3r4rWrEr lstriprrXendswithappendr ) r6r#r&r!r"special_prefixesprefixcompsrus r7rrsy dE " " 6CFFF7  CFFF5  ??+ , ,  K||FC((!$''  ??3   $ cMF;;s##D 3 #e**n 8 uQx61 !HHqV# q5U1Q3Z61ac!A#gFAA!V 4 4aFAAQ#e**n  !e ! LL ''r9ctj|}t|sLt|trtj}ntj}t||}t|S)zReturn the absolute version of a path as a fallback function in case `nt._getfullpathname` is not available or raises OSError. See bpo-31047 for more. ) r@rAr r3r4getcwdbgetcwdr r)r6cwds r7_abspath_fallbackr)sb 9T??D ;; dE " " *,,CC)++CC D>>r9)_getfullpathnamec tt|S#ttf$rt |cYSwxYw)z&Return the absolute version of a path.)rrrrrr5s r7r r AsO +#HTNN33 3$ + + +$T** * * * +s AA)_getfinalpathnamereadlinkcd}t}t||vr|t| |}t|}t |s*>!?!?? %$} %F'J#N)++C~~'!2!22 $#|__V,,  #%++ #T??D 5$T**D   5 5 5 !{ .t44DDDDDD  5 !doof55 !z** +&c*oo.>.>)??S[[\\* !$U++t3! D ! ! !;"22! D  !  s0/D D. D))D.F&& G0 GGgetwindowsversionrmrlctj|}t|trd}d}d}nd}d}d}||}|st dtj|} t t |}t t |}t|\}}t|\} } t|t| krt d | d |d | |D} d | |D} d } t| | D],\}}t|t|krn| dz } -|gt| | z z| | dz}|s|St|S#ttttt f$rt#jd||wxYw)z#Return a relative version of a pathrSryrrrrNzno path specifiedzpath is on mount z, start on mount cg|]}||Sr.0rs r7 zrelpath..s<<.s:::1:Q:::r9rrVr+)r@rAr3r4rr rr r rziprXr r^r_r`DeprecationWarningrarb)r6startr#r!r" start_abspath_abs start_drive start_rest path_drive path_rest start_list path_listrue1e2rel_lists r7r+r+s  9T??D$  .,--- Ie  EHUOO,, 8D>>**",Y"7"7 Z *8 4 4 I K HZ$8$8 8 ** KK)** *=<!1!1#!6!6<<< ::  4 4::: *i00  FB||x||+  FAA8s:q01IabbMA MX z>.&s;QQQaz!))FC"8"8">">"@"@AAQQQr9c@g|]\}}|Srr}rrtrhr#s r7rzcommonpath..'s'<<<1qwws||<<zcommonpath..*s3>>$!Q2A2#>>>>>>r9z%Can't mix absolute and relative pathsNc3 K|] \}}|V dSNr)rrtrhs r7r zcommonpath..1s&--A1------r9rVzPaths don't have the same drivec$g|] }||k | Srrrrr!s r7rzcommonpath..6s'999q9Q&[9!999r9c,g|]}fd|DS)c$g|] }||k | Srrr s r7rz)commonpath...8s':::a:a6k::::r9r)rrJr!s r7rzcommonpath..8s.PPPq::::1:::PPPr9r/)rtupler]r@rAr3r4rrXr rErminmax enumerater r^r_rarb)rc drivesplits split_pathsr rr6commons1s2rurrr&r!r#s @@@r7r/r/s} B@AAA #bi'' ( (E%(E""!QQQQQ5QQQ <<<< <<<  P>>>>+>>>>>FEE P P PDEE4 O P s------- . .! 3 @>?? ? q!1!1&#!>!>?? tC9999V999PPPPKPPP      bMM & &DAqBqEz  HSWWH%F %05(((( ~ &$\:E:::: s%%GB! G!B<r s          A A A!,---------- 8888$ , , ,,,,,, ,$ < < < )))^000p.888 (0 $$$$%%%%%%%:---zjjj`<+!!!!!!l++++i1(1(1(0(0(0(0(0(1(x" +###### ++++    GGG N>>>>>>>> (((T,,,\"'000000yHHH`&gc+>??>3c355a8A=++++p111h #"""""""   DD si =AA8A??B B B B+*B+2B<<CC CC)(C)D!!D*)D*