3 \6Z'@s>dZdZdZdZdZdZdZdZdZdd 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/d0d1g'Z d2d3Zd4d Zd5d Zd6d Zd7dZd8d"Zd9dZd:dZe jje_d;dZddZydd?lmZWnek r2d ZYnXd@dZdAdZdBdZ dCd Z!dDdEZ"yddFlm#Z#Wnek re"Z$Yn XdGd!Z$e$Z%e&e dHoe j'dIdJkZ(dRdKd-Z)dLd1Z*y,e j'd dJdSkrddNlm+Z+neWn"e,efk rdOdPZ+YnXyddQlm-Z.Wnek r8YnXd S)TzCommon 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 expandvarsnormpathabspathsplitunccurdirpardirseppathsepdefpathaltsepextsepdevnullrealpathsupports_unicode_filenamesrelpathsamefile sameopenfilesamestat commonpathcCst|trdSdSdS)Ns\/z\/) isinstancebytes)pathr1/usr/lib64/python3.6/ntpath.py _get_bothseps"s r3c Csxtj|}y.t|tr&|jddjS|jddjSWn: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__)sr1r1r2r,s  cCs2tj|}t|d}t|dko0|dt|kS)zTest whether a path is absoluter)r6r7r lenr3)r?r1r1r2rCs  c GsVtj|}t|tr"d}d}d}n d}d}d}y|sD|dd|t|\}}xttj|D]}t|\}} | r| d|kr|s| r|}| }q^n*|r||kr|j|jkr|}| }q^|}|r|d |kr||}|| }q^W|r|d|kr|r|d d|kr|||S||Sttt fk rPt j d |f|YnXdS) Nr5s\/:rz\/:rr@r rD) r6r7r.r/r mapr9r:r; BytesWarning genericpath_check_arg_types) r0pathsr!sepscolonZ result_driveZ result_pathpZp_driveZp_pathr1r1r2r KsF        cCstj|}t|dkrt|tr0d}d}d}n d}d}d}|j||}|dd|dkr|dd |kr|j|d}|d kr|d d|fS|j||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. r5r4rBrrrCrr@NrDrD)r6r7rAr.r/r8find)rLr!r$rKZnormpindexZindex2r1r1r2r zs.   $  cCsFddl}|jdtdt|\}}t|dkr>|dd|fS||fS)aDeprecated since Python 3.1. Please use splitdrive() instead; it now handles UNC paths. Split a pathname into UNC mount point and relative path specifiers. Return a 2-tuple (unc, rest); either part may be empty. If unc is not empty, it has the form '//host/mount' (or similar using backslashes). unc+rest is always the input path. Paths containing drive letters never have a UNC part. rNzJszrelpath..cSsg|] }|r|qSr1r1)rrr1r1r2rKsrr@r))r6r7r.r/r~rrr rr ziprAr r:r;rFrSrGrH)r0startr!rr Z start_absZpath_absZ start_driveZ start_restZ path_driveZ path_rest start_list path_listrWZe1Ze2rel_listr1r1r2r).sF         c s|s tdtttj|}t|dtr8dddn dddy>fd d |D}fd d |D}ytfd d |D\}Wntk rtddYnXttdd |Ddkrtdt |dj \}}|j }fdd |D}fdd |D}t |}t |}xBt|D]&\} } | || kr,|d| }Pq,W|dt|}|rt|n|} | j|Sttfk rtjd|YnXdS)zDGiven a sequence of path names, returns the longest common sub-path.z%commonpath() arg is an empty sequencerr5r4rZrrrcs g|]}t|jjqSr1)r r8r9)rrL)r$r!r1r2rwszcommonpath..csg|]\}}|jqSr1)r )rrVrL)r!r1r2rxsc3s"|]\}}|ddkVqdS)Nr@r1)rrVrL)r!r1r2 {szcommonpath..z%Can't mix absolute and relative pathsNcss|]\}}|VqdS)Nr1)rrVrLr1r1r2rsr@zPaths don't have the same drivecsg|]}|r|kr|qSr1r1)rr)rr1r2rscsg|]}fdd|DqS)csg|]}|r|kr|qSr1r1)rr)rr1r2rsz)commonpath...r1)rr?)rr1r2rsr-)r-)r~tuplerEr6r7r.r/setrAr r8r minmax enumerater r:r;rGrH) rIZ drivesplits split_pathsrrTr0commons1s2rWrrr1)r$rr!r2r-fsF  )_getfinalpathnamecCs tt|S)N)rr)fr1r1r2rsr)_isdir)N)rr)/__doc__rr r%r!r"r$r#r&r6sysr^rG__all__r3rrr r rr r r[r rrrntrb ImportErrorrrrrrrrr'hasattrrr(r)r-rr;rrr1r1r1r2s|      /4   2q1   85