ó zfc$@spdZddlZddlZddlZddlZddlZddlTddlmZddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(g$Zd)Zd*Z d)Z d+Z d,Z d-Z d.Zd/ejkrd0Znd1ejkr(d-Z nd2Zd3„Zd4„Zd5„Zd6„Zd7„Zd8„Zd9„Zejje_d:„Zd;„Zd<„ZeZd=„Zd>„Zd?„Z d@„Z!dA„Z"yddBl#m$Z$Wne%k rśdC„Z&n XdD„Z&e&Z'e(edEƒo,ej)ƒdFdGkZ*dH„Z+edI„Z,yddJl#m-Z.Wne%k rknXdS(KsCommon pathname manipulations, WindowsNT/95 version. Instead of importing this module directly, import os and refer to this module as os.path. i’’’’N(t*(t_unicodetnormcasetisabstjoint splitdrivetsplittsplitexttbasenametdirnamet commonprefixtgetsizetgetmtimetgetatimetgetctimetislinktexiststlexiststisdirtisfiletismounttwalkt expandusert expandvarstnormpathtabspathtsplitunctcurdirtpardirtseptpathseptdefpathtaltseptextseptdevnulltrealpathtsupports_unicode_filenamestrelpatht.s..s\t;t/s.;C:\bintces\Windowstos2tnulcCs|jddƒjƒS(saNormalize case of pathname. Makes all characters lowercase and all slashes into backslashes.R(s\(treplacetlower(ts((s/usr/lib64/python2.7/ntpath.pyR+scCs*t|ƒd}|dko)|d dkS(sTest whether a path is absoluteits/\(R(R.((s/usr/lib64/python2.7/ntpath.pyR8scGst|ƒ\}}xŹ|D]Ā}t|ƒ\}}|ri|ddkri|sT| r]|}n|}qnE|r®||kr®|jƒ|jƒkr„|}|}qn|}n|rŃ|ddkrŃ|d}n||}qW|r|ddkr|r|ddkr|t|S||S(s>Join two or more pathname components, inserting "\" as needed.is\/i’’’’s\t:(RR-R(tpathtpathst result_drivet result_pathtptp_drivetp_path((s/usr/lib64/python2.7/ntpath.pyR?s*      cCst|ƒdkrų|jttƒ}|dd!tdkrÓ|dd!tkrÓ|jtdƒ}|dkrvd|fS|jt|dƒ}||dkr¦d|fS|dkrĮt|ƒ}n|| ||fS|ddkrų|d |dfSnd|fS(sŚSplit 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. iiiii’’’’R/R0(tlenR,R Rtfind(R5tnormptindextindex2((s/usr/lib64/python2.7/ntpath.pyR`s*    cCsć|dd!dkrd|fS|dd!}|dksB|dkrŁ|jdd ƒ}|jd dƒ}|dkr|d|fS|jd |dƒ}||dkr¬d|fS|d krĒt|ƒ}n|| ||fSd|fS( s?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. iiR0R/is//s\\s\R(i’’’’(R,R9R8(R5tfirstTwoR:R;R<((s/usr/lib64/python2.7/ntpath.pyRŠs      cCs„t|ƒ\}}t|ƒ}x(|rH||ddkrH|d}q!W|| ||}}|}x$|rŠ|ddkrŠ|d }qgW|p”|}|||fS(s~Split a pathname. Return tuple (head, tail) where tail is everything after the final slash. Either part may be empty.is/\i’’’’(RR8(R5tdtitheadttailthead2((s/usr/lib64/python2.7/ntpath.pyR®s  cCstj|tttƒS(N(t genericpatht _splitextRR R!(R5((s/usr/lib64/python2.7/ntpath.pyRĒscCst|ƒdS(s)Returns the final component of a pathnamei(R(R5((s/usr/lib64/python2.7/ntpath.pyRĪscCst|ƒdS(s-Returns the directory component of a pathnamei(R(R5((s/usr/lib64/python2.7/ntpath.pyR ÕscCstS(sNTest for symbolic link. On WindowsNT/95 and OS/2 always returns false (tFalse(R1((s/usr/lib64/python2.7/ntpath.pyRÜscCsRt|ƒ\}}|r"|dkSt|ƒd}t|ƒdkoQ|ddkS(s?Test whether a path is a mount point (defined as root of drive)R/R(s\iis/\(R/R(s\(RRR8(R1tunctrestR5((s/usr/lib64/python2.7/ntpath.pyRčs  cCs‘tjdddƒytj|ƒ}Wntjk r=dSX||||ƒx<|D]4}t||ƒ}t|ƒrUt|||ƒqUqUWdS(sIDirectory tree walk with callback function. For each directory in the directory tree rooted at top (including top itself, but excluding '.' and '..'), call func(arg, dirname, fnames). dirname is the name of the directory, and fnames a list of the names of the files and subdirectories in dirname (excluding '.' and '..'). func may modify the fnames list in-place (e.g. via del or slice assignment), and walk will only recurse into the subdirectories whose names remain in fnames; this can be used to implement a filter, or to impose a specific order of visiting. No semantics are defined for, or required of, arg, beyond that arg is always passed to func. It can be used, e.g., to pass a filename pattern, or a mutable object designed to accumulate statistics. Passing None for arg is common.s4In 3.x, os.path.walk is removed in favor of os.walk.t stackleveliN(twarningstwarnpy3ktostlistdirterrorRRR(ttoptfunctargtnamestname((s/usr/lib64/python2.7/ntpath.pyRłs   cCs|d dkr|Sdt|ƒ}}x*||krS||dkrS|d}q*Wdtjkrstjd}nsdtjkr’tjd}nTdtjkr„|Sytjd}Wntk rĻd}nXt|tjdƒ}|dkrtt|ƒ|d|!ƒ}n|||S( sLExpand ~ and ~user constructs. If user or $HOME is unknown, do nothing.it~s/\tHOMEt USERPROFILEtHOMEPATHt HOMEDRIVER/(R8RKtenvirontKeyErrorRR (R1R?tntuserhometdrive((s/usr/lib64/python2.7/ntpath.pyRs&   c sĖd|krd|kr|Sddl}|j|jd}t|tƒritjƒ‰‡fd†}n d„}d}d }t|ƒ}x:||krĘ||}|d kr!||d }t|ƒ}y)|jd ƒ}|d ||d  }Wq¹t k r|||}|d }q¹Xn˜|dkr’||d |d !dkr_||}|d }q¹||d }t|ƒ}y|jdƒ}Wn)t k r·|d|}|d }q¹X|| }y|||ƒ}Wq¹t k rū|d|d}q¹Xnŗ|dkrÆ||d |d !dkr=||}|d }q¹||d |d !d krų||d }t|ƒ}yW|jdƒ}|| }y|||ƒ}Wn#t k rĒ|d|d}nXWq¬t k rō|d|}|d }q¬Xq¹d}|d }|||d !}xA|dkr\||kr\||}|d }|||d !}qWy|||ƒ}Wnt k r’|d|}nX|dkr¹|d }q¹n ||}|d }qW|S(sfExpand shell variables of the forms $var, ${var} and %var%. Unknown variables are left unchanged.t$t%i’’’’Ns_-cstj|jˆƒjˆƒS(N(RKRXtencodetdecode(tvar(tencoding(s/usr/lib64/python2.7/ntpath.pytgetenvQscSs tj|S(N(RKRX(Ra((s/usr/lib64/python2.7/ntpath.pyRcTsR/is'iit{t}s${( tstringt ascii_letterstdigitst isinstanceRtsystgetfilesystemencodingR8R;t ValueErrorRY( R1RftvarcharsRctresR;tpathlentcRa((Rbs/usr/lib64/python2.7/ntpath.pyRGsŽ                            cCsæt|tƒrd nd \}}|jdƒr4|S|jddƒ}t|ƒ\}}|dkr’xV|d dkrŽ||}|d }qgWn+|jdƒr½||}|jdƒ}n|jdƒ}d }x»|t|ƒkr||dkr||=qÕ||d kr‚|d krP||d d krP||d |d 5|d 8}qŒ|d kru|jdƒru||=qŒ|d 7}qÕ|d 7}qÕW| r®| r®|j |ƒn||j |ƒS(s0Normalize path, eliminating double slashes, etc.u\u.s\R&s\\.\s\\?\R(R/iis..(u\u.(s\R&(s\\.\s\\?\(R&R/( RiRt startswithR,RtlstripRR8tendswithtappendR(R1t backslashtdottprefixtcompsR?((s/usr/lib64/python2.7/ntpath.pyRŸs8!        (t_getfullpathnamecCsRt|ƒsHt|tƒr*tjƒ}n tjƒ}t||ƒ}nt|ƒS(s&Return the absolute version of a path.(RRiRRKtgetcwdutgetcwdRR(R1tcwd((s/usr/lib64/python2.7/ntpath.pyRŲs   cCsa|r-yt|ƒ}WqWtk r)qWXn*t|tƒrKtjƒ}n tjƒ}t|ƒS(s&Return the absolute version of a path.(Ryt WindowsErrorRiRRKRzR{R(R1((s/usr/lib64/python2.7/ntpath.pyRćs  tgetwindowsversioniicCsztt|ƒƒ}t|ƒ\}}t|ƒ}|sKt|ƒ\}}n||g|jtƒD]}|ra|^qafS(N(RRRtboolRRR(R1tabsRwRGtis_unctx((s/usr/lib64/python2.7/ntpath.pyt_abspath_split÷s  c Cs1|stdƒ‚nt|ƒ\}}}t|ƒ\}}}||Arbtd||fƒ‚n|jƒ|jƒkr²|r™td||fƒ‚q²td||fƒ‚nd}xCt||ƒD]2\} } | jƒ| jƒkršPn|d7}qČWtgt|ƒ|||} | s'tSt| ŒS(s#Return a relative version of a pathsno path specifieds,Cannot mix UNC and non-UNC paths (%s and %s)s,path is on UNC root %s, start on UNC root %ss&path is on drive %s, start on drive %sii(RlRƒR-tzipRR8RR( R1tstartt start_is_unct start_prefixt start_listt path_is_unct path_prefixt path_listR?te1te2trel_list((s/usr/lib64/python2.7/ntpath.pyR%’s, (t_isdir(/t__doc__RKRjtstatRCRIRt__all__RRR!RRR Rtbuiltin_module_namesR"RRRRRRRRDRR RRRRRRRRtntRyt ImportErrorRR#thasattrR~R$RƒR%RR(((s/usr/lib64/python2.7/ntpath.pytsp          ! * $       $ * X 5