QfydZdZdZdZdZdZdZdZdZdd l Z dd l Z dd l Z dd l Z dd l gd Z d Z dd lmZmZmZdZdZdZdZdZdZdZe j<je_dZdZ e!e jDdrdZ#ndZ#dZ$ ddl%m&Z&dZ'dZ(dZ) dd l%m*Z+d"Z, dd#l%m-Z-d$Z. dd%l%m/Z/m0Z1d&Z2d'Z3d(d)d*Z4d+Z5d5d,Z6d-Z7 dd.l%m8Z9dd/l%m:Z;dd0l%mZ? dd2l%m@Z@d3ZAy #e$rdZYwxYw#e$rd Z&YvwxYw#e$rd!Z+YtwxYw#e$re,Z.YtwxYw#e$re.Z4YlwxYw#e$rYUwxYw#e$rd4ZAYy wxYw)6zCommon 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 splitdrive splitrootsplitsplitextbasenamedirname commonprefixgetsizegetmtimegetatimegetctimeislinkexistslexistsisdirisfileismount expanduser expandvarsnormpathabspathcurdirpardirseppathsepdefpathaltsepextsepdevnullrealpathsupports_unicode_filenamesrelpathsamefile sameopenfilesamestat commonpath isjunctionc&t|tryy)N\/\/) isinstancebytespaths -/opt/alt/python312/lib64/python3.12/ntpath.py _get_bothsepsr:#s$) LCMapStringExLOCALE_NAME_INVARIANTLCMAP_LOWERCASEcXtj|}|s|St|tr]t j }|j |djdd}ttt|}|j|dSttt|jddS)nNormalize case of pathname. Makes all characters lowercase and all slashes into backslashes. surrogateescaperr) osfspathr5r6sysgetfilesystemencodingdecodereplace_LCMapStringEx_LOCALE_NAME_INVARIANT_LCMAP_LOWERCASEencode)sencodings r9r r 3s IIaLH a 002H#45==c4HA5/4A88H&78 8!"8"2"#))C"68 8r;ctj|}t|trFtjtj |j ddjS|j ddjS)r@rr)rBrCr5r6fsencodefsdecoderGlower)rLs r9r r Fsb IIaL a ;;r{{1~55c4@FFHI Iyyd#))++r;ctj|}t|trd}d}d}nd}d}d}|ddj ||}|j |s|j |d ry y ) zTest whether a path is absolute\/s:\rrz:\NTF)rBrCr5r6rG startswith)rLr$r' colon_seps r9r r Wsn ! A!U   "1 fc"A ||CALLA6 r;c8tj|}t|trd}d}d}nd}d}d} |s|dd|zt |\}}}t tj|D]b}t |\} } } | r | s|s| }| }| }| r/| |k7r*| j |j k7r| }| }| }N| }|r |d|vr||z}|| z}d|r|s|r|dd||zvr||z|zS||z|zS#tttf$rtjd |g|wxYw) NrSr3:rr4:rr ) rBrCr5r6rmaprQ TypeErrorAttributeError BytesWarning genericpath_check_arg_types) r8pathsr$sepscolon result_drive result_root result_pathpp_drivep_rootp_paths r9r r ks_ 99T?D$! !HsN1:4. k;RYY&A&/l #GVV,#*L$ $ W 4==?l&8&8&::#*L"(K"(K& {2d:)C/ %.K+'.  \"#.edlB#% 3 3k)K77 ~| 4$$VT:E: sB/C,$C,,-Dc.t|\}}}|||zfS)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. )r)ridriveroottails r9r r s#&"! E4 $+ r;ctj|}t|tr d}d}d}d}d}n d}d}d}d }d }|j ||}|d d |k(r||d d |k(ri|d dj |k(rdnd }|j ||}|dk(r|||fS|j ||d z} | dk(r|||fS|d | || | d z|| d zd fS||d d |d d fS|d d |k(r!|d d|k(r|d d |d d|dd fS|d d ||d d fS|||fS)aSplit a pathname into drive, root and tail. The drive is defined exactly as in splitdrive(). On Windows, the root may be a single path separator or an empty string. The tail contains anything after the root. For example: splitroot('//server/share/') == ('//server/share', '/', '') splitroot('C:/Users/Barney') == ('C:', '/', 'Users/Barney') splitroot('C:///spam///ham') == ('C:', '/', '//spam///ham') splitroot('Windows/notepad') == ('', '', 'Windows/notepad') rSrTrZ\\?\UNC\r;rrr[\\?\UNC\NrVr\rU)rBrCr5r6rGupperfind) rir$r're unc_prefixemptynormpstartindexindex2s r9rrs ! A!U$ #  IIfc "E RayC 1: r*j8AaEJJsE*E{%&ZZUQY/F|%&Wf:q 3Qvz{^C C!BQ%12& & qu  1: Ra5!Aa&!AB%' 'Ra5%12& &eQr;ctj|}t|}t|\}}}t |}|r||dz |vr|dz}|r ||dz |vr|d|||d}}||z|j |z|fS)z~Split a pathname. Return tuple (head, tail) where tail is everything after the final slash. Either part may be empty.rVN)rBrCr:rlenrstrip)rirddriheadrps r9rrs ! A  DlGAq! AA !A#d" Q !A#d"2A!"$D q54;;t$ $d **r;ctj|}t|trt j |dddSt j |dddS)NrSrT.rrr)rBrCr5r6ra _splitextris r9rrsG ! A!U$$QtT::$$Qc377r;ct|dS)z)Returns the final component of a pathnamerVrrs r9rr  8A;r;ct|dS)z-Returns the directory component of a pathnamerrrs r9rrrr;st_reparse_tagc tj|}t |j tjk(S#tttf$rYywxYwz!Test whether a path is a junctionF) rBlstatOSError ValueErrorr_boolrstatIO_REPARSE_TAG_MOUNT_POINTr8sts r9r1r1sM $BB%%)H)HHII^4  s=AAc.tj|yr)rBrCr7s r9r1r1#s $r;cZ tj|}y#ttf$rYywxYw)zCTest whether a path exists. Returns True for broken symbolic linksFT)rBrrrrs r9rr+s2 XXd^  Z s **)_getvolumepathnamec>tj|}t|}t|}t |\}}}|r |d|vr| S|r|syt rL|j |}t |j |}|j|jk(Sy)zaTest whether a path is a mount point (a drive root, the root of a share, or a mounted volume)rTF)rBrCr:r!rrrcasefold)r8rdrnrorestxys r9rrAs 99T?D  D 4=D!$E4 qT!x D KK  d # * *4 0zz|qzz|++r;c8tj|}t|trd}nd}|j |s|Sdt |}}||kr+||t |vr|dz }||kr||t |vrdtjvrtjd}nEdtjvr|S tjd}t|tjd}|dk7rs|d|}t|trtj|}tjjd}||k7r%|t|k7r|Stt||}t|trtj|}|||d zS#t$rd}YwxYw) zLExpand ~ and ~user constructs. If user or $HOME is unknown, do nothing.~~rV USERPROFILEHOMEPATH HOMEDRIVErtUSERNAMEN)rBrCr5r6rWrr:environKeyErrorr rPgetrrrO)r8tildernuserhomern target_user current_users r9rr^s{ 99T?D$ ??5 ! c$iqA a%DG=#66 Q a%DG=#66 "::m, 2:: %  JJ{+Erzz*56Av1Qi k5 )++k2Kzz~~j1 , & x11 GH-{;H$;;x( d12h / E s6F FFctj|}t|trPd|vrd|vr|Sddl}t|j |j zdzd}d}d}d}d }d}ttd d}nDd |vrd |vr|Sddl}|j |j zdz}d }d }d}d}d }tj}|dd} d} t|} | | kr|| | dz} | |k(r5|| dzd}t|} |j| } | | |d| dzzz } n| |k(r|| dz| dz|k(r | | z } | dz } n|| dzd}t|} |j|} |d| } |:tjtjtj| }n|| }| |z } n%| |k(r|| dz| dz|k(r | | z } | dz } n|| dz| dz|k(rr|| dzd}t|} |j|} |d| } |:tjtjtj| }n|| }| |z } n|dd} | dz } || | dz} | r| |vr| | z } | dz } || | dz} | r| |vr |:tjtjtj| }n|| }| |z } | r | dz} n| | z } | dz } | | kr| S#t$r| | |zz } | dz } Y&wxYw#t$r || z|z}YjwxYw#t$r| ||zz } | dz } YZwxYw#t$r||z| z|z}YwxYw#t$r| ||z|zz } | dz } YwxYw#t$r|| z}YwxYw)zfExpand shell variables of the forms $var, ${var} and %var%. Unknown variables are left unchanged.$%rNz_-ascii'{}environb$%'{}rVru)rBrCr5r6string ascii_lettersdigitsgetattrrrr}rrOrPr)r8rvarcharsquotepercentbracerbracedollarrresr}pathlencvarvalues r9rrsH 99T?D$ t D 0K-- =DgN"j$/ d?s$K''&--7$>** r(C E$iG '/ uQw  : #D$iG $ 1 q4 +++'\EAIeai(G3q E!GH~d)! JJw/E v,C8"?$&KK 2;;s;K0L$ME$+CLE5LC &[EAIeai(F2q eai *e3E!GH~d)! JJv.E v,C>"?$&KK 2;;s;K0L$ME$+CLE5LC2Ah uqy)AM1HCQJEU519-AAM) " BJJr{{37G,H I ' u QJE 1HC  W '/X JI $q4x!  $,$8 '#  78"(7T>)C#aKE(@$> & 4v =>"(6E>D00C#aKE(4 )"SLE)so3KL AK5(M?AL)8AM"K21K25L  L  L&%L&)M?MMM"M32M3)_path_normpathc tj|}t|tr d}d}d}d}nd}d}d}d}|j ||}t |\}}}||z}|j |}d } | t|kr_|| r|| |k(r|| =n?|| |k(r2| d kDr|| d z |k7r|| d z | d z=| d z} n| d k(r|r|| =n | d z } n| d z } | t|kr_|s|s|j|||j|zS) z0Normalize path, eliminating double slashes, etc.rSrTr..rrrrrrV) rBrCr5r6rGrrrappendr ) r8r$r'r"r#rnroprefixcompsrs r9r r s3yy dE "CFFFCFFF||FC(%dOtT 3 #e*n8uQx61!HqV#q5U1Q3Z61ac!A#gFA!VaFAQ#e*ne LL ''r;ctj|}t|sEt|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. ) rBrCr r5r6getcwdbgetcwdr r )r8cwds r9_abspath_fallbackr4sM 99T?D ; dE "**,C))+CC D>r;)_getfullpathnamecl tt|S#ttf$rt |cYSwxYw)z&Return the absolute version of a path.)rr rrrr7s r9r!r!Ls5 +#HTN3 3$ +$T* * +s 33)_getfinalpathnamereadlinkcxd}t}t||vro|jt| |}t|}t |s.t |s|} |St tt||}t||vro|S#t$r}|j|vrYd}~|Sd}~wt$rY|SwxYw)N) rVrurU 2CWi&i(i)) setr add _nt_readlinkr rr r rrwinerrorr)r8allowed_winerrorseenold_pathexs r9_readlink_deeprYsLutnD( HHXd^ $ #D)T{"(+' $D):D$ABDtnD(,  ;;"22     s)%B B B9B)(B)) B98B9cfd}|dd}|r t|}|r t||S|S|S#t$r{}|j|vr t |}||k7r|r t||n|cYd}~Sn#t$rYnwxYwt |\}}|r |s ||zcYd}~S|r t||n|}Yd}~nd}~wwxYw|r)N)rVrurUrrrr5Arr{iir)rr rrrr)r8rrprnew_pathnames r9_getfinalpathname_nonstrictrs$XBQx :(.+/tD$'9T9* ) :;;&66  .d3H4'7;tHd3I(#4[ d$;&+/tD$'T' : sN(( B,B'A' B,&B'' A30B'2A33B' B,B''B,F)strictct|}t|trId}d}d}tj}t |t tj tk(r7yd}d}d}tj}t |t tk(ry|j|}|st|s t||} t|}d }|sU|j|rD|j|r||t%|dz} n|t%|d} t| |k(r| }|S|S#t$r,}|rtt|dt|}Yd}~d}~wt$r$}|r|j }t#|}Yd}~d}~wwxYw#t$r }Yd}~|Sd}~wt$r}|j k(r| }Yd}~|Sd}~wwxYw) Ns\\?\rrs\\s\\.\NULz\\?\rsz\\z\\.\NULr)r r5r6rBrr rOr)rrWr r rrrstrrrr) r8rrrynew_unc_prefixr had_prefixinitial_winerrorrspaths r9r*r*s~ dE "F(J$N**,C~"++g*>!??$F'J#N))+C~'!22#__V, %+T?D 5$T*D "doof5z*&c*o.>)??S[\* !$U+t3 D t I " c"g&D0D>D 5!{{ .t4D  5&    !;;"22 D  !sB D,F, F 5"E F (FF  G G*GGTcLtj|}t|trd}d}d}nd}d}d}||}|s t dtj|} t t |}t t |}t|\}}} t|\} }} t|t| k7rt d | d || j|D cgc]} | s|  } } | j|D cgc]} | s|  }} d }t| |D]#\}}t|t|k7rn|d z }%|gt| |z z||dz}|s|St|Scc} wcc} w#ttttt f$rt#j$d ||wxYw)z#Return a relative version of a pathrSrrrrrNzno path specifiedzpath is on mount z, start on mount rrVr,)rBrCr5r6rr!r rr rziprr r^r_r`DeprecationWarningrarb)r8r|r$r"r# start_abspath_abs start_drive_ start_rest path_drive path_restr start_list path_listre1e2rel_lists r9r,r,s 99T?D$ } ,-- IIe EHUO, 8D>*%.y%9" Q #,X#6 Ay K HZ$8 8K)* *",!1!1#!6BE,E"#E"'E,<E'E'AE,E," E,,7F#c `|s tdtttj|}t |dt rd}d}d}nd}d}d} |Dcgc]+}t|j||j-}}|Dcgc]\}}}|j|}}}}t|Dchc]\}}}| c}}}d k7r td t|Dchc]\}}}| c}}}d k7r td t|dj||\} } } | j|} | D cgc] } | s| |k7s | } } |D cgc]}|D cgc] } | s| |k7s | c} }}} t|}t|}t|D]\}} | ||k7s| d |} n| d t|} | | z|j| zScc}wcc}}}wcc}}}wcc}}}wcc} wcc} wcc} }w#t t"f$rt%j&d g|wxYw)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerrSrTrrrrrVz%Can't mix absolute and relative pathszPaths don't have the same driveNr0)rtupler]rBrCr5r6rrGrQrrminmax enumerater r^r_rarb)rcr$r'r"ri drivesplitsrr split_pathsrnror8commonrrLs1s2rs r9r0r0.s- @AA #bii' (E%(E"JOP%Qy63!7!=!=!?@% P3>?;1aqwws|; ? -gaA- .! 3DE E -gaA- .! 3>? ?%eAh&6&6vs&CDtTC#9VqQ&[!V9DOPKq1:1aa6k1:K P    bMDAqBqEz" HSW%Ft|chhv...5Q?- . ::P ~ &$$\:E: sH0GHG!*H9 G( "H( G/ 5AHG6 G6G6H H%G; -G; 3G; 7H<2H/,HH;HH'H-) _path_isdir) _path_isfile) _path_islink) _path_exists)_path_isdevdrivecJ tt|S#t$rYywxYwz@Determines whether the specified path is on a Windows Dev Drive.F)rr!rr7s r9 isdevdriverts( #GDM2 2  s  ""cyrr7s r9rrosr;)N)B__doc__r"r#r(r$r%r'r&r)rBrDrra__all__r:_winapir<rHr=rIr>rJr ImportErrorr r r rrrrrrhasattr stat_resultr1rntrrrrrr rrr!rrrrrr*r+r,r0rrrrrrrrrrrr;r9r$s          O!,-- 8H(+b.1r +*8 ((00  2>>+,J$%:-zj`&(-P" +# +]> (T/b"'<@"+p.b  ())) #_ ,, ,t^#("(#(t G Hd  s} C3DD(D2D)D6)E3C>=C>D  D DDD&%D&)D32D36D>=D>E  E