;
Êâ"Ic            *   @   sÓ  d  Z  d d l Z d d l Z d d l Z d d l Z d d l Td d d d d d	 d
 d d d d d d d d d d d d d d d d d d d d d d  d! d" d# d$ d% d& d' d( g% Z d) Z d* Z d) Z d+ Z	 d, Z
 d- Z d Z d. Z d/ „  Z d0 „  Z d1 „  Z d2 „  Z d3 „  Z d4 „  Z e j j  e _  d5 „  Z d6 „  Z d7 „  Z d8 „  Z d9 „  Z d: „  Z d; „  Z d< „  Z d= „  Z d> „  Z d a  d a! d? „  Z" d@ „  Z# dA „  Z$ dB „  Z% dC „  Z& dE Z( d dD „ Z) d S(F   uç  Common operations on Posix pathnames.

Instead of importing this module directly, import os and refer to
this module as os.path.  The "os.path" name is an alias for this
module on Posix systems; on other systems (e.g. Mac, Windows),
os.path provides the same operations in a manner specific to that
platform, and is an alias to another module (e.g. macpath, ntpath).

Some of this can actually be useful on non-Posix systems too, e.g.
for manipulation of the pathname component of URLs.
i    N(   u   *u   normcaseu   isabsu   joinu
   splitdriveu   splitu   splitextu   basenameu   dirnameu   commonprefixu   getsizeu   getmtimeu   getatimeu   getctimeu   islinku   existsu   lexistsu   isdiru   isfileu   ismountu
   expanduseru
   expandvarsu   normpathu   abspathu   samefileu   sameopenfileu   samestatu   curdiru   pardiru   sepu   pathsepu   defpathu   altsepu   extsepu   devnullu   realpathu   supports_unicode_filenamesu   relpathu   .u   ..u   /u   :u   :/bin:/usr/binu	   /dev/nullc             C   s   t  |  t ƒ o d Sd Sd  S(   Ns   /u   /(   u
   isinstanceu   bytes(   u   path(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   _get_sep&   s    c             C   s   |  S(   u6   Normalize case of pathname.  Has no effect under Posix(    (   u   s(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   normcase1   s    c             C   s   t  |  ƒ } |  j | ƒ S(   u   Test whether a path is absolute(   u   _get_sepu
   startswith(   u   su   sep(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   isabs:   s    c             G   su   t  |  ƒ } |  } x\ | D]T } | j | ƒ o
 | } q | p | j | ƒ o | | 7} q | | | 7} q W| S(   uœ   Join two or more pathname components, inserting '/' as needed.
    If any component is an absolute path, all previous path components
    will be discarded.(   u   _get_sepu
   startswithu   endswith(   u   au   pu   sepu   pathu   b(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   joinD   s     
c             C   s{   t  |  ƒ } |  j | ƒ d } |  d | … |  | d … } } | o* | | t | ƒ k o | j | ƒ } n | | f S(   u€   Split a pathname.  Returns tuple "(head, tail)" where "tail" is
    everything after the final slash.  Either part may be empty.i   N(   u   _get_sepu   rfindu   lenu   rstrip(   u   pu   sepu   iu   headu   tail(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   splitY   s    !c             C   sB   t  |  t ƒ o d } d } n d } d } t j |  | d  | ƒ S(   Ns   /s   .u   /u   .(   u
   isinstanceu   bytesu   genericpathu	   _splitextu   None(   u   pu   sepu   extsep(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   splitexti   s    
c             C   s   |  d d … |  f S(   uJ   Split a pathname into drive and path. On Posix, drive is always
    empty.Ni    (    (   u   p(    (    u&   /mit/python/lib/python3.0/posixpath.pyu
   splitdrivev   s    c             C   s-   t  |  ƒ } |  j | ƒ d } |  | d … S(   u)   Returns the final component of a pathnamei   N(   u   _get_sepu   rfind(   u   pu   sepu   i(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   basename~   s    c             C   sd   t  |  ƒ } |  j | ƒ d } |  d | … } | o* | | t | ƒ k o | j | ƒ } n | S(   u-   Returns the directory component of a pathnamei   N(   u   _get_sepu   rfindu   lenu   rstrip(   u   pu   sepu   iu   head(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   dirname‡   s    c          	   C   sG   y t  j |  ƒ } Wn! t  j t f k
 o d SYn Xt j | j ƒ S(   u&   Test whether a path is a symbolic linkF(   u   osu   lstatu   erroru   AttributeErroru   Falseu   statu   S_ISLNKu   st_mode(   u   pathu   st(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   islink”   s
    
c             C   s5   y t  j |  ƒ } Wn t  j k
 o d SYn Xd S(   uC   Test whether a path exists.  Returns True for broken symbolic linksFT(   u   osu   lstatu   erroru   Falseu   True(   u   pathu   st(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   lexistsž   s
    
c             C   s+   t  j |  ƒ } t  j | ƒ } t | | ƒ S(   u9   Test whether two pathnames reference the same actual file(   u   osu   statu   samestat(   u   f1u   f2u   s1u   s2(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   samefile©   s    c             C   s+   t  j |  ƒ } t  j | ƒ } t | | ƒ S(   u:   Test whether two open file objects reference the same file(   u   osu   fstatu   samestat(   u   fp1u   fp2u   s1u   s2(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   sameopenfile³   s    c             C   s#   |  j  | j  k o |  j | j k S(   u5   Test whether two stat buffers reference the same file(   u   st_inou   st_dev(   u   s1u   s2(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   samestat½   s    c          	   C   s¾   yT t  j |  ƒ } t |  t ƒ o t |  d ƒ } n t |  d ƒ } t  j | ƒ } Wn t  j k
 o d SYn X| j } | j } | | k o d S| j	 } | j	 } | | k o d Sd S(   u$   Test whether a path is a mount points   ..u   ..FT(
   u   osu   lstatu
   isinstanceu   bytesu   joinu   erroru   Falseu   st_devu   Trueu   st_ino(   u   pathu   s1u   parentu   s2u   dev1u   dev2u   ino1u   ino2(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   ismountÆ   s"    
				c             C   s†  t  |  t ƒ o
 d } n d } |  j | ƒ p |  St |  ƒ } |  j | d ƒ } | d k  o t |  ƒ } n | d k oI d t j k o( d d l } | j	 t j
 ƒ  ƒ j } q<t j d } nw d d l } |  d | … } t  | t ƒ o t | d ƒ } n y | j | ƒ } Wn t k
 o |  SYn X| j } t  |  t ƒ o | j t j ƒ  ƒ } n | j | ƒ } | |  | d … S(   uO   Expand ~ and ~user constructions.  If user or $HOME is unknown,
    do nothing.s   ~u   ~i   i    u   HOMENu   ASCII(   u
   isinstanceu   bytesu
   startswithu   _get_sepu   findu   lenu   osu   environu   pwdu   getpwuidu   getuidu   pw_diru   stru   getpwnamu   KeyErroru   encodeu   sysu   getfilesystemencodingu   rstrip(   u   pathu   tildeu   sepu   iu   pwdu   userhomeu   nameu   pwent(    (    u&   /mit/python/lib/python3.0/posixpath.pyu
   expanduserå   s6    

	c             C   sä  t  |  t ƒ oW d |  k o |  St p% d d l } | j d | j ƒ a n t j } d } d } nT d |  k o |  St p% d d l } | j d | j ƒ a n t j } d	 } d
 } d } x| |  | ƒ } | p Pn | j d ƒ \ } } | j	 d ƒ } | j
 | ƒ o$ | j | ƒ o | d d … } n t  | t ƒ o t | d ƒ } n | t j k on |  | d … }	 t j | }
 t  |  t ƒ o |
 j d ƒ }
 n |  d | … |
 }  t |  ƒ } |  |	 7}  qÃ | } qÃ |  S(   uZ   Expand shell variables of form $var and ${var}.  Unknown variables
    are left unchanged.s   $i    Ns   \$(\w+|\{[^}]*\})s   {s   }u   $u   \$(\w+|\{[^}]*\})u   {u   }i   iÿÿÿÿu   ASCII(   u
   isinstanceu   bytesu	   _varprogbu   reu   compileu   ASCIIu   searchu   _varprogu   spanu   groupu
   startswithu   endswithu   stru   osu   environu   encodeu   len(   u   pathu   reu   searchu   startu   endu   iu   mu   ju   nameu   tailu   value(    (    u&   /mit/python/lib/python3.0/posixpath.pyu
   expandvars  sL    	
	 	c       	      C   ss  t  |  t ƒ o d } d } d } d } n d } d } d } d } |  | k o | S|  j | ƒ } | o3 |  j | d	 ƒ o |  j | d
 ƒ o
 d	 } n |  j | ƒ } g  } xƒ | D]{ } | | | f k o q» n | | k p( | o | p | o" | d | k o | j | ƒ q» | o | j ƒ  q» q» W| } | j | ƒ }  | o | | |  }  n |  p | S(   u0   Normalize path, eliminating double slashes, etc.s   /s    s   .s   ..u   /u    u   .u   ..i   i   iÿÿÿÿ(   u
   isinstanceu   bytesu
   startswithu   splitu   appendu   popu   join(	   u   pathu   sepu   emptyu   dotu   dotdotu   initial_slashesu   compsu	   new_compsu   comp(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   normpathA  s>    
)
 c             C   sV   t  |  ƒ p? t |  t ƒ o t j ƒ  } n t j ƒ  } t | |  ƒ }  n t |  ƒ S(   u   Return an absolute path.(   u   isabsu
   isinstanceu   bytesu   osu   getcwdbu   getcwdu   joinu   normpath(   u   pathu   cwd(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   abspathf  s    c             C   s*  t  |  t ƒ o d } d } n d } d } t |  ƒ o$ | g |  j | ƒ d d … } n | g |  j | ƒ } xª t d t | ƒ d ƒ D] } t | d | … Œ  } t | ƒ of t | ƒ } | d k o" t
 t | g | | d … Œ  ƒ St | g | | d … Œ  } t | ƒ Sq q Wt
 |  ƒ S(	   ul   Return the canonical path of the specified filename, eliminating any
symbolic links encountered in the path.s   /s    u   /u    i   Ni   i    (   u
   isinstanceu   bytesu   isabsu   splitu   rangeu   lenu   joinu   islinku   _resolve_linku   Noneu   abspathu   realpath(   u   filenameu   sepu   emptyu   bitsu   iu	   componentu   resolvedu   newpath(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   realpatht  s$    
$ "c             C   s‹   g  } x~ t  |  ƒ op |  | k o d S| j |  ƒ t j |  ƒ } t | ƒ p% t |  ƒ } t t | | ƒ ƒ }  q	 t | ƒ }  q	 W|  S(   uÈ   Internal helper function.  Takes a path and follows symlinks
    until we either arrive at something that isn't a symlink, or
    encounter a path we've seen before (meaning that there's a loop).
    N(	   u   islinku   Noneu   appendu   osu   readlinku   isabsu   dirnameu   normpathu   join(   u   pathu
   paths_seenu   resolvedu   dir(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   _resolve_link‘  s     c       	      C   sã   |  p t  d ƒ ‚ n t |  t ƒ o d } d } d } n d } d } d } | d k o
 | } n t | ƒ j | ƒ } t |  ƒ j | ƒ } t t | | g ƒ ƒ } | g t | ƒ | | | d … } | p | St | Œ  S(	   u#   Return a relative version of a pathu   no path specifieds   .s   /s   ..u   .u   /u   ..N(	   u
   ValueErroru
   isinstanceu   bytesu   Noneu   abspathu   splitu   lenu   commonprefixu   join(	   u   pathu   startu   curdiru   sepu   pardiru
   start_listu	   path_listu   iu   rel_list(    (    u&   /mit/python/lib/python3.0/posixpath.pyu   relpath§  s$    

%F(*   u   __doc__u   osu   sysu   statu   genericpathu   __all__u   curdiru   pardiru   extsepu   sepu   pathsepu   defpathu   Noneu   altsepu   devnullu   _get_sepu   normcaseu   isabsu   joinu   splitu   splitextu	   _splitextu
   splitdriveu   basenameu   dirnameu   islinku   lexistsu   samefileu   sameopenfileu   samestatu   ismountu
   expanduseru   _varprogu	   _varprogbu
   expandvarsu   normpathu   abspathu   realpathu   _resolve_linku   Falseu   supports_unicode_filenamesu   relpath(    (    (    u&   /mit/python/lib/python3.0/posixpath.pyu   <module>   s\   
					
								
		
	
				'	2	%			