ó õ^‚Rc$@s`dZddlZddlZddlZddlZddlZddlTdddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'g$Zd(Zd)Zd(Z d*Z d+Z d,Z d-Z d.ejkrd/Z nd0ejkrd,Z nd1Zd2„Zd3„Zd4„Zd5„Zd6„Zd7„Zd8„Zejje_d9„Zd:„Zd;„ZeZd<„Zd=„Zd>„Zd?„Z d@„Z!yddAl"m#Z#Wne$k rêdB„Z%n XdC„Z%e%Z&e'edDƒoej(ƒdEdFkZ)dG„Z*edH„Z+yddIl"m,Z-Wne$k r[nXdS(JsCommon pathname manipulations, WindowsNT/95 version. Instead of importing this module directly, import os and refer to this module as os.path. iÿÿÿÿN(t*tnormcasetisabstjoint 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/lib/python2.7/ntpath.pyR*scCs*t|ƒd}|dko)|d dkS(sTest whether a path is absoluteits/\(R(R-((s/usr/lib/python2.7/ntpath.pyR7scGsw|}xj|D]b}d}|dkr.d}n{t|ƒr©|dd!dks`|dd!dkrid}q©t|ƒdkst|ƒdkr©|ddkr©d}q©n|r¸|}q t|ƒdksÐt‚|ddkr|r|ddkr||d7}qo||7}q |ddkr1||7}q |re|ddkrT||7}qo|d |7}q |d 7}q W|S( sœJoin two or more pathname components, inserting "\" as needed. If any component is an absolute path, all previous path components will be discarded.iR.iit:iiÿÿÿÿs/\s\(RtlentAssertionError(tatptpathtbtb_wins((s/usr/lib/python2.7/ntpath.pyR?s4    & $     cCs2|dd!dkr(|dd!|dfSd|fS(slSplit a pathname into drive and path specifiers. Returns a 2-tuple "(drive,path)"; either part may be emptyiiR/iR.((R3((s/usr/lib/python2.7/ntpath.pyRzscCsÃ|dd!dkrd|fS|dd!}|dksB|dkr¹t|ƒ}|jddƒ}|d krvd|fS|jd|dƒ}|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 an UNC part. iiR/R.is//s\\s\iÿÿÿÿ(RtfindR0(R3tfirstTwotnormptindex((s/usr/lib/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ÿÿÿÿ(RR0(R3tdtitheadttailthead2((s/usr/lib/python2.7/ntpath.pyR¤s  cCstj|tttƒS(N(t genericpatht _splitextRRR (R3((s/usr/lib/python2.7/ntpath.pyR½scCst|ƒdS(s)Returns the final component of a pathnamei(R(R3((s/usr/lib/python2.7/ntpath.pyRÄscCst|ƒdS(s-Returns the directory component of a pathnamei(R(R3((s/usr/lib/python2.7/ntpath.pyRËscCstS(sNTest for symbolic link. On WindowsNT/95 and OS/2 always returns false (tFalse(R4((s/usr/lib/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\(RRR0(R4tunctrestR3((s/usr/lib/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/lib/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.(R0RHtenvirontKeyErrorRR(R4R<tntuserhometdrive((s/usr/lib/python2.7/ntpath.pyRs&   cCs‚d|krd|kr|Sddl}|j|jd}d}d}t|ƒ}x'||kr}||}|dkrç||d }t|ƒ}y)|jdƒ}|d||d  }Wqptk rã||}|d }qpXn‰|dkrÀ||d |d !dkr%||}|d }qp||d }t|ƒ}y|jdƒ}Wn)tk r}|d|}|d }qpX|| }|tjkr«|tj|}qp|d|d}n°|dkrf||d |d !dkrþ||}|d }qp||d |d !d kr´||d }t|ƒ}yR|jd ƒ}|| }|tjkrr|tj|}n|d |d }Wqctk r°|d |}|d }qcXqpd}|d }|||d !}xA|dkr||kr||}|d }|||d !}qØW|tjkr<|tj|}n|d|}|dkrp|d }qpn ||}|d }qWW|S(sfExpand shell variables of the forms $var, ${var} and %var%. Unknown variables are left unchanged.t$t%iÿÿÿÿNs_-R.is'iit{t}s${(tstringt ascii_letterstdigitsR0R:t ValueErrorRHRU(R4R^tvarcharstresR:tpathlentctvar((s/usr/lib/python2.7/ntpath.pyR=s€                        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.( t isinstancetunicodet startswithR+RtlstripRR0tendswithtappendR(R4t backslashtdottprefixtcompsR<((s/usr/lib/python2.7/ntpath.pyRŽs8!        (t_getfullpathnamecCsRt|ƒsHt|tƒr*tjƒ}n tjƒ}t||ƒ}nt|ƒS(s&Return the absolute version of a path.(RRgRhRHtgetcwdutgetcwdRR(R4tcwd((s/usr/lib/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.(Rqt WindowsErrorRgRhRHRrRsR(R4((s/usr/lib/python2.7/ntpath.pyRÒs  tgetwindowsversioniicCsztt|ƒƒ}t|ƒ\}}t|ƒ}|sKt|ƒ\}}n||g|jtƒD]}|ra|^qafS(N(RRRtboolRRR(R4tabsRoRDtis_unctx((s/usr/lib/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(RaR{R,tzipRR0RR( R4tstartt start_is_unct start_prefixt start_listt path_is_unct path_prefixt path_listR<te1te2trel_list((s/usr/lib/python2.7/ntpath.pyR$îs, (t_isdir(.t__doc__RHtsyststatR@RFt__all__RRR RRRRtbuiltin_module_namesR!RRRRRRRRARRRRRRRRRRtntRqt ImportErrorRR"thasattrRvR#R{R$R‡R(((s/usr/lib/python2.7/ntpath.pytsn          ; !       $ * Q 5