B \]DW&@s4dZdZdZdZdZdZdZdZdZdd l Z dd l Z dd l Z dd l Z dd l Td d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g&Z d1d2Zd3d Zd4d Zd5d Zd6dZd7dZd8dZe jje_d9dZd:dZd;dZddZd?dZd@dZdAd Z dBdCZ!yddDlm"Z"Wnek r|e!Z#Yn XdEd!Z#e#Z$e%e dFoe &dGdHkZ'dPdId,Z(dJd0Z)y,e &d dHdKkrddLlm*Z*neWn"e+efk rdMdNZ*YnXyddOlm,Z-Wnek r.YnXd S)QzCommon pathname manipulations, WindowsNT/95 version. Instead of importing this module directly, import os and refer to this module as os.path. .z..\;/z.;C:\binZnulN)*normcaseisabsjoin splitdrivesplitsplitextbasenamedirname commonprefixgetsizegetmtimegetatimegetctimeislinkexistslexistsisdirisfileismount expanduser expandvarsnormpathabspathcurdirpardirseppathsepdefpathaltsepextsepdevnullrealpathsupports_unicode_filenamesrelpathsamefile sameopenfilesamestat commonpathcCst|trdSdSdS)Ns\/z\/) isinstancebytes)pathr0"/usr/local/lib/python3.7/ntpath.py _get_bothseps"s r2c Csxt|}y.t|tr&|ddS|ddSWn:ttfk rrt|ttfsltd|j j dYnXdS)zaNormalize case of pathname. Makes all characters lowercase and all slashes into backslashes./\rrz0normcase() argument must be str or bytes, not %rN) osfspathr-r.replacelower TypeErrorAttributeErrorstr __class____name__)sr0r0r1r,s  cCs2t|}t|d}t|dko0|dt|kS)zTest whether a path is absoluter)r5r6r lenr2)r>r0r0r1rCs  c GsTt|}t|tr"d}d}d}n d}d}d}y|sD|dd|t|\}}xttj|D]~}t|\}} | r| d|kr|s|s|}| }q^n*|r||kr||kr|}| }q^|}|r|d|kr||}|| }q^W|r|d|kr|r|dd|kr|||S||Sttt fk rNt j d |f|YnXdS) Nr4s\/:rz\/:rr ) r5r6r-r.r mapr8r9r: BytesWarning genericpath_check_arg_types) r/pathsr sepscolonZ result_driveZ result_pathpZp_driveZp_pathr0r0r1r KsF       cCst|}t|dkrt|tr0d}d}d}n d}d}d}|||}|dd|dkr|dd |kr||d}|d kr|d d|fS|||d }||d kr|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. r4r3rArrrBrrCNr?)r5r6r@r-r.r7find)rKr r#rJZnormpindexZindex2r0r0r1r zs.   $  cCs|t|}t|}t|\}}t|}x |rF||d|krF|d8}q(W|d|||d}}||pn|}|||fS)z~Split a pathname. Return tuple (head, tail) where tail is everything after the final slash. Either part may be empty.r?N)r5r6r2r r@rstrip)rKrIdiheadtailr0r0r1r s   cCs8t|}t|tr$t|dddSt|dddSdS)Nr4r3.rrr)r5r6r-r.rF _splitext)rKr0r0r1r s  cCs t|dS)z)Returns the final component of a pathnamer?)r )rKr0r0r1r scCs t|dS)z-Returns the directory component of a pathnamer)r )rKr0r0r1rsc Cs4yt|}Wnttfk r&dSXt|jS)zhTest whether a path is a symbolic link. This will always return false for Windows prior to 6.0. F)r5lstatOSErrorr:statS_ISLNKst_mode)r/str0r0r1rs cCs(yt|}Wntk r"dSXdS)zCTest whether a path exists. Returns True for broken symbolic linksFT)r5rWrX)r/r\r0r0r1rs )_getvolumepathnamecCstt|}t|}t|}t|\}}|rD|d|krD| pB||kS||krPdStrl||t||kSdSdS)zaTest whether a path is a mount point (a drive root, the root of a share, or a mounted volume)rTFN)r5r6r2rr r]rP)r/rIrootrestr0r0r1rs  cCst|}t|trd}nd}||s,|Sdt|}}x$||kr^||t|kr^|d7}q4szrelpath..cSsg|] }|r|qSr0r0)rrr0r0r1r5srr?r()r5r6r-r.r|rrr rr zipr@r r9r:rEDeprecationWarningrFrG)r/startr rrZ start_absZpath_absZ start_driveZ start_restZ path_driveZ path_rest start_list path_listrRZe1Ze2rel_listr0r0r1r(sF         c s|s tdtttj|}t|dtr8dddn dddy>fd d |D}fd d |D}ytfd d |D\}Wntk rtddYnXttdd |Ddkrtdt |d \}}| }fdd |D}fdd |D}t |}t |}xBt|D]&\} } | || kr,|d| }Pq,W|dt|}|rt|n|} | |Sttfk rtjd|YnXdS)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr4r3rUrrrcs g|]}t|qSr0)r r7r8)rrK)r#r r0r1raszcommonpath..csg|]\}}|qSr0)r )rrQrK)r r0r1rbsc3s"|]\}}|ddkVqdS)Nr?r0)rrQrK)r r0r1 eszcommonpath..z%Can't mix absolute and relative pathsNcss|]\}}|VqdS)Nr0)rrQrKr0r0r1rlsr?zPaths don't have the same drivecsg|]}|r|kr|qSr0r0)rr)rr0r1rqscsg|]}fdd|DqS)csg|]}|r|kr|qSr0r0)rr)rr0r1rssz)commonpath...r0)rr>)rr0r1rssr,)r,)r|tuplerDr5r6r-r.setr@r r7r minmax enumerater r9r:rFrG) rHZ drivesplits split_pathsrrkr/commons1s2rRrrr0)r#rr r1r,PsF  )r)_getfinalpathnamecCs tt|S)N)rr)fr0r0r1rsr)_isdir)N).__doc__rrr$r r!r#r"r%r5sysrYrF__all__r2rrr r r r rVr rrrntr] ImportErrorrrrrrrrr&hasattrrr'r(r,rr:rrr0r0r0r1sz       /8   2q1   85