U e5dVl&@s$dZdZdZdZdZdZdZdZddlZddl Z ddl Z ddl Z dd l Td d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/g&Z d0d1Z d2d Zd3d Zd4d Zd5d Zd6dZd7dZe jje_d8dZd9dZd:dZd;dZzdddZd?dZd@dZ dAdBZ!zddClm"Z"Wnek rxe!Z#Yn XdDd Z#zddElm$Z$m%Z&Wnek re#Z'YnXdFdGZ(dHdIZ)dJd)Z'e*e dKoe +dLdMkZ,dQdNd+Z-dOd/Z.zddPlm/Z0Wnek rYnXdS)R...\;/z.;C:\binZnulN)*normcaseisabsjoin splitdrivesplitsplitextbasenamedirname commonprefixgetsizegetmtimegetatimegetctimeislinkexistslexistsisdirisfileismount expanduser expandvarsnormpathabspathcurdirpardirseppathsepdefpathaltsepextsepdevnullrealpathsupports_unicode_filenamesrelpathsamefile sameopenfilesamestat commonpathcCst|trdSdSdS)N\/\/) isinstancebytespathr4/usr/lib64/python3.8/ntpath.py _get_bothseps"s r6cCs8t|}t|tr$|ddS|ddSdS)N/\rr)osfspathr0r1replacelowersr4r4r5r,s  cCsjt|}t|tr,|dddrBdSn|dddrBdSt|d}t|d koh|d t|kS) Nr7r8\\?\Trr\\?\r) r9r:r0r1r; startswithr lenr6r=r4r4r5r =s   c GsTt|}t|tr"d}d}d}n d}d}d}z|sD|dd|t|\}}ttj|D]~}t|\}} | r| d|kr|s|s|}| }q\n*|r||kr||kr|}| }q\|}|r|d|kr||}|| }q\|r|d|kr|r|dd|kr|||WS||WSttt fk rNt j d |f|YnXdS) Nr8r.:rr/:rr ) r9r:r0r1r mapr< TypeErrorAttributeError BytesWarning genericpath_check_arg_types) r3pathsr!sepscolonZ result_driveZ result_pathpZp_driveZp_pathr4r4r5r MsL       cCst|}t|dkrt|tr0d}d}d}n d}d}d}|||}|dd|dkr|dd |kr||d}|d kr|dd|fS|||d }||d kr|dd|fS|d krt|}|d|||dfS|d d|kr|dd|ddfS|dd|fS) Nr8r7rDrrrErrFrA)r9r:rCr0r1r;find)rPr!r$rOZnormpindexZindex2r4r4r5r |s.   $  cCsxt|}t|}t|\}}t|}|rD||d|krD|d8}q&|d|||d}}||pj|}|||fSNrA)r9r:r6r rCrstrip)rPrNdiheadtailr4r4r5r s   cCs8t|}t|tr$t|dddSt|dddSdS)Nr8r7.rrr)r9r:r0r1rK _splitextrPr4r4r5r s  cCs t|dSrUr r]r4r4r5rscCs t|dS)Nrr^r]r4r4r5rsc Cs8zt|}Wntttfk r*YdSXt|jS)NF)r9lstatOSError ValueErrorrIstatS_ISLNKst_moder3str4r4r5rs c Cs.zt|}Wnttfk r(YdSXdS)NFT)r9r_r`rarer4r4r5rs )_getvolumepathnamecCstt|}t|}t|}t|\}}|rD|d|krD| pB||kS||krPdStrl||t||kSdSdS)NrTF)r9r:r6rr rgrV)r3rNrootrestr4r4r5rs  cCst|}t|trd}nd}||s,|Sdt|}}||kr\||t|kr\|d7}q:dtjkrrtjd}nFdtjkr|Sztjd}Wntk rd}YnXt |tjd}t|trt |}|dkrt t ||d|}|||dS)N~~rAZ USERPROFILEZHOMEPATHZ HOMEDRIVE) r9r:r0r1rBrCr6environKeyErrorr fsencoder)r3tilderXnuserhomedriver4r4r5r!s.          cCs2t|}t|trhd|kr(d|kr(|Sddl}t|j|jdd}d}d}d}d}d}ttd d}nFd |kr|d |kr||Sddl}|j|jd}d }d }d }d}d }tj}|dd} d} t |} | | kr.|| | d} | |krX|| dd}t |} z&| | } | | |d| d7} Wn*t k rR| | |7} | d} YnXn| |krJ|| d| d|kr| | 7} | d7} n|| dd}t |} z| |} Wn*t k r| ||7} | d} YnhX|d| } z.|dkrt tjt | }n|| }Wn"tk r<|| |}YnX| |7} n| |kr|| d| d|kr| | 7} | d7} q$|| d| d|kr^|| dd}t |} z| |} Wn.t k r| |||7} | d} YnlX|d| } z.|dkr"t tjt | }n|| }Wn&tk rR||| |}YnX| |7} n|dd} | d7} || | d} | r| |kr| | 7} | d7} || | d} qz.|dkrt tjt | }n|| }Wntk r|| }YnX| |7} | r$| d8} n| | 7} | d7} q| S)N$%rz_-ascii'{}environb$%'{}rArQ)r9r:r0r1stringZ ascii_lettersZdigitsgetattrrmrCrTrarofsdecodern)r3rZvarcharsZquoteZpercentZbraceZrbraceZdollarrmresrTZpathlencvarvaluer4r4r5rQs                         c CsPt|}t|tr*d}d}d}d}d}nd}d}d}d }d }||rL|S|||}t|\}}||r||7}||}||}d }|t |kr,||r|||kr||=q|||kr"|d kr||d |kr||d |d =|d 8}n&|d kr| |r||=n|d 7}q|d 7}q|sB|sB| ||| |S) Nr8r7r[..)s\\.\r?rrrr)z\\.\r@rrA) r9r:r0r1rBr;r lstripr rCendswithappendr ) r3r!r$rr Zspecial_prefixesprefixcompsrXr4r4r5rsF             cCs@t|}t|s8t|tr&t}nt}t||}t|SN) r9r:r r0r1getcwdbgetcwdr r)r3cwdr4r4r5_abspath_fallbacks    r)_getfullpathnamec Cs4ztt|WSttfk r.t|YSXdSr)rrr`rarr2r4r4r5r s)_getfinalpathnamereadlinkc Csd}t}t||kr|t|z:|}t|}t|s\t|sJ|}Wqttt||}Wq t k r}z|j |krWYqW5d}~XYq t k rYqYq Xq |S)N) rArQrR 2CWi&i(i)) setradd _nt_readlinkr rrr rr`winerrorra)r3allowed_winerrorseenZold_pathexr4r4r5_readlink_deeps&   rc Csd}d}|rzt|}|r$t||n|WStk r}z|j|krFz0t|}||krt|rft||n|WWYTSWntk rYnXt|\}}|r|s||WYS|rt||n|}W5d}~XYqXq|S)N) rArQrRrrrrrr{iirl)rr r`rrr )r3rrZrnew_pathnamer4r4r5_getfinalpathname_nonstrictCs(   &rc Cs^t|}t|trBd}d}d}t}t|tttkrjdSn(d}d}d}t}t|ttkrjdS| |}|st |st ||}zt |}d }Wn0t k r}z|j}t|}W5d}~XYnX|sZ| |rZ| |r||t|d}n|t|d}zt ||kr"|}Wn4t k rX}z|j|krH|}W5d}~XYnX|S) Nr?s\\?\UNC\s\\s\\.\NULr@z\\?\UNC\z\\z\\.\NULr)rr0r1r9rrror&rrBr r rr`rrrC) r3rZ unc_prefixZnew_unc_prefixrZ had_prefixZinitial_winerrorrZspathr4r4r5r'qsD      getwindowsversionrRrQc Csft|}t|tr"d}d}d}n d}d}d}|dkr:|}|sFtdt|}ztt|}tt|}t|\}}t|\} } t|t| krtd| |fd d | |D} d d | |D} d } t | | D]$\}}t|t|krq| d 7} q|gt | | | | d}|s(|WSt |WSt ttttfk r`td||YnXdS)Nr8r[rrrrzno path specifiedz&path is on mount %r, start on mount %rcSsg|] }|r|qSr4r4.0xr4r4r5 szrelpath..cSsg|] }|r|qSr4r4rr4r4r5rsrrAr))r9r:r0r1rarrr rr ziprCr rHrIrJDeprecationWarningrKrL)r3startr!rr Z start_absZpath_absZ start_driveZ start_restZ path_driveZ path_rest start_list path_listrXZe1Ze2rel_listr4r4r5r)sJ         c s|s tdtttj|}t|dtr8dddn dddz@fd d |D}fd d |D}ztfd d |D\}Wntk rtddYnXttdd |Ddkrtdt |d \}}| }fdd |D}fdd |D}t |}t |}t|D]*\} } | || kr*|d| }qfq*|dt|}|rt|n|} | |WSttfk rtjd|YnXdS)Nz%commonpath() arg is an empty sequencerr8r7r[rrrcs g|]}t|qSr4)r r;r<)rrP)r$r!r4r5rszcommonpath..csg|]\}}|qSr4r^rrWrPr!r4r5rsc3s"|]\}}|ddkVqdSrUr4rrr4r5 szcommonpath..z%Can't mix absolute and relative pathscss|]\}}|VqdSrr4rr4r4r5rsrAzPaths don't have the same drivecsg|]}|r|kr|qSr4r4rrrr4r5rscsg|]}fdd|DqS)csg|]}|r|kr|qSr4r4rrr4r5rsz)commonpath...r4)rr>rr4r5rsr-)r-)ratuplerGr9r:r0r1rrCr r;r minmax enumerater rHrIrKrL) rMZ drivesplits split_pathsr rsr3commons1s2rXrrr4)r$rr!r5r-sF   )_isdir)N)1rr r%r!r"r$r#r&r9sysrbrK__all__r6rr r r r r r\__doc__rrrrntrg ImportErrorrrrrrrrrrrr'rrhasattrrr(r)r-rrr4r4r4r5 s  /8   0q2  *.2  84