mò %U²Ic#@s2dZdkZdkZdkZdddddddd d d d d ddddddddddddddddddd d!d"d#d$g#Zd%Zd&Zd%Zd'Zd(Z d)Z d*Z d+ei jo d,Z nd-ei jo d)Z nd.Z d/„Zd0„Zd1„Zd2„Zd3„Zd4„Zd5„Zd6„Zd7„Zd8„Zd9„Zd:„Zd;„Zd<„Zd=„Zd>„ZeZd?„Zd@„Z dA„Z!dB„Z"dC„Z#dD„Z$dE„Z%ydFk&l'Z'Wne(j odG„Z)n XdH„Z)e)Z*e+edIƒoei,ƒdJdKjZ-dS(LsCommon pathname manipulations, WindowsNT/95 version. Instead of importing this module directly, import os and refer to this module as os.path. Ntnormcasetisabstjoint splitdrivetsplittsplitexttbasenametdirnamet commonprefixtgetsizetgetmtimetgetatimetgetctimetislinktexiststlexiststisdirtisfiletismounttwalkt expandusert expandvarstnormpathtabspathtsplitunctcurdirtpardirtseptpathseptdefpathtaltseptextseptdevnulltrealpathtsupports_unicode_filenamest.s..s\t;t/s.;C:\bintces\Windowstos2tnulcCs|iddƒiƒS(saNormalize case of pathname. Makes all characters lowercase and all slashes into backslashes.R%s\N(tstreplacetlower(R)((t#/data/zmath/lib/python2.4/ntpath.pyR&scCs+t|ƒd}|djo|d djS(sTest whether a path is absoluteits/\N(RR)(R)((R,R3scGsw|}xj|D]b}d}|djo d}n…t|ƒow|dd!djp|dd!djo d}q´t|ƒdjp$t|ƒdjo|ddjo d}q´n|o |}q |ddjo8|o#|ddjo||d7}qo||7}q |ddjo||7}q |o1|ddjo||7}qo|d |7}q |d 7}q W|S( s=Join two or more pathname components, inserting "\" as needediR-iit:iiÿÿÿÿs/\s\N(tatpathtptbtb_winsRtlen(R/R1R2R0R3((R,R;s6   ( 7 cCs7|dd!djo|dd!|dfSnd|fS(slSplit a pathname into drive and path specifiers. Returns a 2-tuple "(drive,path)"; either part may be emptyiiR.iR-N(R1(R1((R,RtscCsÕ|dd!djod|fSn|dd!}|djp |djo‚t|ƒ}|iddƒ}|d jod|fSn|id|dƒ}|d jot|ƒ}n|| ||fSnd|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ÿÿÿÿN(R1tfirstTwoRtnormptfindtindexR4(R1R8R5R6((R,R}s    cCs¬t|ƒ\}}t|ƒ}x+|o#||ddjo|d}q!W|| ||}}|}x'|o|ddjo|d }qjW|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ÿÿÿÿN(RR1tdR4titheadttailthead2(R1R;R9R:R<R=((R,Ržs  cCs[|idƒ}|t|idƒ|idƒƒjo|dfSn|| ||fSdS(s‘Split the extension from a pathname. Extension is everything from the last dot to the end. Return (root, ext), either part may be empty.R#R%s\R-N(R1trfindR:tmax(R1R:((R,R·s (cCst|ƒdS(s)Returns the final component of a pathnameiN(RR1(R1((R,RÆscCst|ƒdS(s-Returns the directory component of a pathnameiN(RR1(R1((R,RÍscCsŒ|pdSn|d}xl|D]d}x[tt|ƒƒD]G}||d ||d jo$|| }|djodSnPq9q9Wq W|S(sGGiven a list of pathnames, returns the longest common leading componentR-iiN(tmtprefixtitemtrangeR4R:(R@R:RBRA((R,RÔs    cCsti|ƒiS(s0Return the size of a file, reported by os.stat()N(toststattfilenametst_size(RF((R,R ãscCsti|ƒiS(sBReturn the last modification time of a file, reported by os.stat()N(RDRERFtst_mtime(RF((R,R çscCsti|ƒiS(s<Return the last access time of a file, reported by os.stat()N(RDRERFtst_atime(RF((R,R ëscCsti|ƒiS(s:Return the creation time of a file, reported by os.stat().N(RDRERFtst_ctime(RF((R,R ïscCstS(s=Test for symbolic link. On WindowsNT/95 always returns falseN(tFalse(R0((R,R öscCs4yti|ƒ}Wntij o tSnXtS(sTest whether a path existsN(RDRER0tstterrorRKtTrue(R0RL((R,Rýs  cCs@yti|ƒ}Wntij o tSnXti|iƒS(s"Test whether a path is a directoryN(RDRER0RLRMRKtS_ISDIRtst_mode(R0RL((R,R s  cCs@yti|ƒ}Wntij o tSnXti|iƒS(s%Test whether a path is a regular fileN(RDRER0RLRMRKtS_ISREGRP(R0RL((R,Rs  cCsXt|ƒ\}}|o|djSnt|ƒd}t|ƒdjo|ddjS( s?Test whether a path is a mount point (defined as root of drive)R-R%s\iis/\N(R-R%s\(RR0tunctrestRR1R4(R0RSR1RR((R,R%s cCsœyti|ƒ}Wntij o dSnX||||ƒd}xO|D]G}||jo4t ||ƒ}t |ƒot |||ƒq”qMqMWdS(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.NR#s..(R#s..( RDtlistdirttoptnamesRMtfunctargt exceptionstnameRRR(RURWRXRZRVRY((R,R6s    cCsù|d djo|Sndt|ƒ}}x-||jo||djo|d}q/W|djo€dtijotid}qídtijo|Sqíytid}Wntj o d}nXt |tidƒ}n|S|||S( sLExpand ~ and ~user constructs. If user or $HOME is unknown, do nothing.it~s/\tHOMEtHOMEPATHt HOMEDRIVER-N( R0R4R:tnRDtenvirontuserhometdrivetKeyErrorR(R0R:RbR_Ra((R,R[s&  cCs’d|jo|Sndk}|i|id}d}d}t|ƒ}xA||jo3||}|djoq||d}t|ƒ}y)|idƒ}|d||d }Wqt j o||}|d}qXnž|djo†||d|d!djo||}|d}q||d|d!d joŠ||d}t|ƒ}yB|id ƒ}|| }|t i jo|t i |}nWqqt j o||}|d}qqXqd}|d}|||d!}xD|djo6||jo)||}|d}|||d!}qíW|t i jo|t i |}n|djo||}qn ||}|d}qMW|S( sZExpand shell variables of form $var and ${var}. Unknown variables are left unchanged.t$Ns_-R-is'iit{t}(R0tstringt ascii_letterstdigitstvarcharstresR8R4tpathlentct ValueErrortvarRDR`(R0R8RmRgRkRjRlRo((R,R}sd                  cCs |iddƒ}t|ƒ\}}|djo1x[|d djo|d}|d}q4Wn.|idƒo|d}|idƒ}n|idƒ}d}xÇ|t |ƒjo³||d jo ||=q§||djox|djo5||ddjo ||d|d5|d8}qi|djo|i dƒo ||=qi|d7}q§|d7}q§W| o| o|i dƒn|di |ƒS( s0Normalize path, eliminating double slashes, etc.R%s\R-iiR#s..N(R#R-( R0R*RRAt startswithtlstripRtcompsR:R4tendswithtappendR(R0R:RrRA((R,R¸s8    " (s_getfullpathnamecCs0t|ƒpttiƒ|ƒ}nt|ƒS(s&Return the absolute version of a path.N(RR0RRDtgetcwdR(R0((R,Rés cCsG|o*yt|ƒ}Wq=tj oq=Xn tiƒ}t|ƒS(s&Return the absolute version of a path.N(R0t_getfullpathnamet WindowsErrorRDRuR(R0((R,Rðs  tgetwindowsversionii(.t__doc__RDREtsyst__all__RRRRRRRtbuiltin_module_namesR RRRRRRRRRRR R R R R RRRRRRRRRtntRvt ImportErrorRR!thasattrRxR"((RRRRRRRRRR RRRR"R{RRR RR R RR!RERRRRzR RRRRvR RRRRRRD((R,t?s^   o    9 !             % " ; -