™N
¨´ 7c       sí   d  Z  k Z k Z k Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e i e i d Z d „  Z d „  Z d S(   s�   Common pathname manipulations, WindowsNT/95 version. 
Instead of importing this module
directly, import os and refer to this module as os.path.
c    s    t  i t  i |  d d ƒ ƒ Sd S(   sg   Normalize case of pathname.

    Makes all characters lowercase and all slashes into backslashes.

    s   /s   \N(   s   strings   lowers   replaces   s(   s   ss"   /mit/gnome/lib/python1.5/ntpath.pys   normcase s     c    s/   t  |  ƒ d }  |  d j o |  d  d j Sd S(   s   Test whether a path is absolutei   s    s   /\N(   s
   splitdrives   s(   s   ss"   /mit/gnome/lib/python1.5/ntpath.pys   isabs s     c    sv   |  } xe | d r[ } t | ƒ o
 | } n? | d j p | d d j o | | } n | t i | } q W| Sd S(   s=   Join two or more pathname components, inserting "\" as neededi    s    i   s   /\N(   s   as   paths   ps   bs   isabss   oss   sep(   s   as   ps   paths   bs"   /mit/gnome/lib/python1.5/ntpath.pys   join' s     	 
c    s;   |  d d !d j o |  d d !|  d f Sn d |  f Sd S(   sl   Split a pathname into drive and path specifiers. Returns a 2-tuple
"(drive,path)";  either part may be emptyi   i   s   :i    s    N(   s   p(   s   ps"   /mit/gnome/lib/python1.5/ntpath.pys
   splitdrive7 s     c    s2  t  |  ƒ \ } }  d } x8 |  o |  d d j o | |  d } |  d  }  q W|  d j o |  | }  n d d f \ } } xA |  d r7 } | | } | d j o | | d f \ } } n q‰ Wd } x8 | o | d d j o | | d } | d  } qÍ W| d j o | | } n | | | f Sd S(   s|   Split a pathname.  Returns tuple "(head, tail)" where "tail" is 
everything after the final slash.  Either part may be emptys    i   s   /\i    N(   s
   splitdrives   ps   ds   slashess   heads   tails   c(   s   ps   ds   slashess   heads   tails   cs"   /mit/gnome/lib/python1.5/ntpath.pys   splitE s.      	 
 c    s»   d d f \ } } x˜ |  d rŽ } | d d g j o | | | d f \ } } nX | d j o+ | o | | | f \ } } n | } n  | o | | } n | | } q W| | f Sd S(   sŒ   Split the extension from a pathname.  Extension is everything from the
last dot to the end.  Returns "(root, ext)", either part may be emptys    i    s   /s   \s   .N(   s   roots   exts   ps   c(   s   ps   roots   exts   cs"   /mit/gnome/lib/python1.5/ntpath.pys   splitextb s     	 
c    s   t  |  ƒ d Sd S(   s)   Returns the final component of a pathnamei   N(   s   splits   p(   s   ps"   /mit/gnome/lib/python1.5/ntpath.pys   basenamew s     c    s   t  |  ƒ d Sd S(   s-   Returns the directory component of a pathnamei    N(   s   splits   p(   s   ps"   /mit/gnome/lib/python1.5/ntpath.pys   dirname~ s     c    s•   |  o d Sn |  d } xp |  d rf } x] t t | ƒ ƒ d rG } | | d  | | d  j o$ | |  } | d j o d Sn Pn q> Wq# W| Sd S(   sG   Given a list of pathnames, returns the longest common leading components    i    i   N(   s   ms   prefixs   items   ranges   lens   i(   s   ms   prefixs   items   is"   /mit/gnome/lib/python1.5/ntpath.pys   commonprefix… s      
	  
 c    s   d Sd S(   s=   Test for symbolic link.  On WindowsNT/95 always returns falsei    N(    (   s   paths"   /mit/gnome/lib/python1.5/ntpath.pys   islink• s     c    s8   y t  i |  ƒ } Wn t  i j
 o d Sn Xd Sd S(   s   Test whether a path existsi    i   N(   s   oss   stats   paths   sts   error(   s   paths   sts"   /mit/gnome/lib/python1.5/ntpath.pys   exists� s     	c    sH   y t  i |  ƒ } Wn t  i j
 o d Sn Xt i | t i ƒ Sd S(   s"   Test whether a path is a directoryi    N(   s   oss   stats   paths   sts   errors   S_ISDIRs   ST_MODE(   s   paths   sts"   /mit/gnome/lib/python1.5/ntpath.pys   isdirª s     	c    sH   y t  i |  ƒ } Wn t  i j
 o d Sn Xt i | t i ƒ Sd S(   s%   Test whether a path is a regular filei    N(   s   oss   stats   paths   sts   errors   S_ISREGs   ST_MODE(   s   paths   sts"   /mit/gnome/lib/python1.5/ntpath.pys   isfile· s     	c    s/   t  i |  ƒ } t  i | ƒ } t | | ƒ Sd S(   s9   Test whether two pathnames reference the same actual fileN(   s   oss   stats   f1s   s1s   f2s   s2s   samestat(   s   f1s   f2s   s1s   s2s"   /mit/gnome/lib/python1.5/ntpath.pys   samefileÂ s     c    s;   t  i |  i ƒ  ƒ } t  i | i ƒ  ƒ } t | | ƒ Sd S(   sS   Test whether two open file objects reference the same file (may not
work correctly)N(   s   oss   fstats   fp1s   filenos   s1s   fp2s   s2s   samestat(   s   fp1s   fp2s   s1s   s2s"   /mit/gnome/lib/python1.5/ntpath.pys   sameopenfileÍ s     c    s7   |  t i | t i j o |  t i | t i j Sd S(   s5   Test whether two stat buffers reference the same fileN(   s   s1s   stats   ST_INOs   s2s   ST_DEV(   s   s1s   s2s"   /mit/gnome/lib/python1.5/ntpath.pys   samestatØ s     c    s5   t  |  ƒ d } t | ƒ d j o | d d j Sd S(   s?   Test whether a path is a mount point (defined as root of drive)i   i    s   /\N(   s
   splitdrives   paths   ps   len(   s   paths   ps"   /mit/gnome/lib/python1.5/ntpath.pys   ismountá s     c    s¤   y t  i |  ƒ } Wn t  i j
 o d Sn X| | |  | ƒ d d f } xQ | d rG } | | j o4 t	 |  | ƒ } t
 | ƒ o t | | | ƒ n n qU Wd S(   s¿   walk(top,func,args) calls func(arg, d, files) for each directory "d" 
in the tree  rooted at "top" (including "top" itself).  "files" is a list
of all the files and subdirs in directory "d".
Ns   .s   ..i    (   s   oss   listdirs   tops   namess   errors   funcs   args
   exceptionss   names   joins   isdirs   walk(   s   tops   funcs   args   namess
   exceptionss   names"   /mit/gnome/lib/python1.5/ntpath.pys   walkï s     		 c    s	  |  d  d j o |  Sn d t |  ƒ f \ } } x- | | j  o |  | d j o | d } q4 W| d j o‡ t i i d ƒ o t i d } n` t i i d ƒ o |  SnD y t i d } Wn t	 j
 o d } n Xt
 | t i d ƒ } n |  S| |  | Sd S(	   sK   Expand ~ and ~user constructions.  If user or $HOME is unknown, 
do nothingi   s   ~s   /\s   HOMEs   HOMEPATHs	   HOMEDRIVEs    N(   s   paths   lens   is   ns   oss   environs   has_keys   userhomes   drives   KeyErrors   join(   s   paths   is   ns   userhomes   drives"   /mit/gnome/lib/python1.5/ntpath.pys
   expanduser
s&      s   _-c    s‹  d |  j o |  Sn d } d } t |  ƒ } xS| | j  oE|  | } | d j ow |  | d }  t |  ƒ } y, t i |  d ƒ } | d |  | d  } Wn* t i j
 o | |  } | d } n Xnª| d j o’|  | d | d !d j o | | } | d } n[|  | d | d !d j o“ |  | d }  t |  ƒ } yH t i |  d ƒ } |  |  } t	 i
 i | ƒ o | t	 i
 | } n Wn* t i j
 o | |  } | d } n Xn¬ d } | d } |  | | d !} xD | d j o
 | t j o) | | } | d } |  | | d !} qßWt	 i
 i | ƒ o | t	 i
 | } n | d j o | | } n n | | } | d } q0 W| Sd	 S(
   sU   Expand shell variables of form $var and ${var}.  Unknown variables
are left unchangeds   $s    i    s   'i   i   s   {s   }N(   s   paths   ress   indexs   lens   pathlens   cs   strings   index_errors   vars   oss   environs   has_keys   varchars(   s   paths   ress   indexs   pathlens   cs   vars"   /mit/gnome/lib/python1.5/ntpath.pys
   expandvars-s`      





 


c    s‰  t  i |  d d ƒ }  t |  ƒ \ } }  x0 |  d  t i j o | t i } |  d }  q* Wt  i |  t i ƒ } d } xÕ | t
 | ƒ j  oÁ | | d j o | | =n¢ | | d j o% | d j o | | d d d f j o  | | d | d 5| d } nI | | d j o | d j o | | d d j o | | =n | d } qx W| o | o | i d ƒ n | t  i | t i ƒ Sd S(	   s0   Normalize path, eliminating double slashes, etc.s   /s   \i   i    s   .s   ..s    N(   s   strings   replaces   paths
   splitdrives   prefixs   oss   seps   splitfieldss   compss   is   lens   appends
   joinfields(   s   paths   prefixs   compss   is"   /mit/gnome/lib/python1.5/ntpath.pys   normpathes,       93N(   s   __doc__s   oss   stats   strings   normcases   isabss   joins
   splitdrives   splits   splitexts   basenames   dirnames   commonprefixs   islinks   existss   isdirs   isfiles   samefiles   sameopenfiles   samestats   ismounts   walks
   expandusers   letterss   digitss   varcharss
   expandvarss   normpath(    s"   /mit/gnome/lib/python1.5/ntpath.pys   ? s2   																				!	8