-í
ç¶<c       s0  d  Z  d k Z d k Z 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 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 Z d S(.   s#   Common operations on DOS pathnames.Ns   normcases   isabss   joins
   splitdrives   splits   splitexts   basenames   dirnames   commonprefixs   getsizes   getmtimes   getatimes   islinks   existss   isdirs   isfiles   ismounts   walks
   expandusers
   expandvarss   normpaths   abspathc    s   |  i d d ƒ i ƒ  Sd S(   s–  Normalize the case of a pathname.
    On MS-DOS it maps the pathname to lowercase, turns slashes into
    backslashes.
    Other normalizations (such as optimizing '../' away) are not allowed
    (this is done by normpath).
    Previously, this version mapped invalid consecutive characters to a
    single '_', but this has been removed.  This functionality should
    possibly be added as a new function.s   /s   \N(   s   ss   replaces   lower(   s   s(    (    s   /usr/lib/python2.2/dospath.pys   normcase s     c    s/   t  |  ƒ d }  |  d j o |  d  d j Sd S(   s  Return whether a path is absolute.
    Trivial in Posix, harder on the Mac or MS-DOS.
    For DOS it is absolute if it starts with a slash or backslash (current
    volume), or if a pathname after the volume letter and colon starts with
    a slash or backslash.i   s    s   /\N(   s
   splitdrives   s(   s   s(    (    s   /usr/lib/python2.2/dospath.pys   isabs s     c    sp   |  } x_ | D]W } t | ƒ o
 | } n; | d j p | d d j o | | } n | d | } q W| Sd S(   s   Join two (or more) paths.s    iÿÿÿÿs   /\:s   \N(   s   as   paths   ps   bs   isabs(   s   as   ps   bs   path(    (    s   /usr/lib/python2.2/dospath.pys   join# s      
c    s;   |  d d !d j o |  d d !|  d f Sn d |  f Sd S(   sž   Split a path into a drive specification (a drive letter followed
    by a colon) and path specification.
    It is always true that drivespec + pathspec == p.i   i   s   :i    s    N(   s   p(   s   p(    (    s   /usr/lib/python2.2/dospath.pys
   splitdrive1 s     c    sµ   t  |  ƒ \ } }  t |  ƒ } x+ | o |  | d d j o | d } q! W|  |  |  | f \ } } | } x' | o | d d j o | d  } qo W| p | } | | | f Sd S(   sâ   Split a path into head (everything up to the last '/') and tail
    (the rest).  After the trailing '/' is stripped, the invariant
    join(head, tail) == p holds.
    The resulting head won't end in '/' unless it is the root.i   s   /\iÿÿÿÿN(   s
   splitdrives   ps   ds   lens   is   heads   tails   head2(   s   ps   tails   ds   is   heads   head2(    (    s   /usr/lib/python2.2/dospath.pys   split; s       c    sˆ   d d f \ } } xe |  D]] } | d j o | | | d f \ } } n- | d j p | o | | } n | | } q W| | f Sd S(   sÓ   Split a path into root and extension.
    The extension is everything starting at the first dot in the last
    pathname component; the root is everything before that.
    It is always true that root + ext == p.s    s   /\s   .N(   s   roots   exts   ps   c(   s   ps   exts   roots   c(    (    s   /usr/lib/python2.2/dospath.pys   splitextO s      c    s   t  |  ƒ d Sd S(   s*   Return the tail (basename) part of a path.i   N(   s   splits   p(   s   p(    (    s   /usr/lib/python2.2/dospath.pys   basename` s     c    s   t  |  ƒ d Sd S(   s)   Return the head (dirname) part of a path.i    N(   s   splits   p(   s   p(    (    s   /usr/lib/python2.2/dospath.pys   dirnamef s     c    s‘   |  o d Sn |  d } xl |  D]d } x[ t t | ƒ ƒ D]G } | | d  | | d  j o$ | |  } | d j o d Sn Pn q: Wq! W| Sd S(   s/   Return the longest prefix of all list elements.s    i    i   N(   s   ms   prefixs   items   ranges   lens   i(   s   ms   items   prefixs   i(    (    s   /usr/lib/python2.2/dospath.pys   commonprefixl s      
  
 c    s   t  i |  ƒ } | t i Sd S(   s1   Return the size of a file, reported by os.stat().N(   s   oss   stats   filenames   sts   ST_SIZE(   s   filenames   st(    (    s   /usr/lib/python2.2/dospath.pys   getsize| s     c    s   t  i |  ƒ } | t i Sd S(   sC   Return the last modification time of a file, reported by os.stat().N(   s   oss   stats   filenames   sts   ST_MTIME(   s   filenames   st(    (    s   /usr/lib/python2.2/dospath.pys   getmtime s     c    s   t  i |  ƒ } | t i Sd S(   s=   Return the last access time of a file, reported by os.stat().N(   s   oss   stats   filenames   sts   ST_ATIME(   s   filenames   st(    (    s   /usr/lib/python2.2/dospath.pys   getatime† s     c    s   d Sd S(   sh   Is a path a symbolic link?
    This will always return false on systems where posix.lstat doesn't exist.i    N(    (   s   path(    (    s   /usr/lib/python2.2/dospath.pys   islinkŒ s     c    s8   y t  i |  ƒ } Wn t  i j
 o d Sn Xd Sd S(   sA   Does a path exist?
    This is false for dangling symbolic links.i    i   N(   s   oss   stats   paths   sts   error(   s   paths   st(    (    s   /usr/lib/python2.2/dospath.pys   exists“ s     	c    sH   y t  i |  ƒ } Wn t  i j
 o d Sn Xt i | t i ƒ Sd S(   s   Is a path a dos directory?i    N(   s   oss   stats   paths   sts   errors   S_ISDIRs   ST_MODE(   s   paths   st(    (    s   /usr/lib/python2.2/dospath.pys   isdirž s     	c    sH   y t  i |  ƒ } Wn t  i j
 o d Sn Xt i | t i ƒ Sd S(   s   Is a path a regular file?i    N(   s   oss   stats   paths   sts   errors   S_ISREGs   ST_MODE(   s   paths   st(    (    s   /usr/lib/python2.2/dospath.pys   isfile¨ s     	c    s   t  t |  ƒ d ƒ Sd S(   s   Is a path a mount point?i   N(   s   isabss
   splitdrives   path(   s   path(    (    s   /usr/lib/python2.2/dospath.pys   ismount² s     c    s¢   y t  i |  ƒ } Wn t  i j
 o d Sn X| | |  | ƒ d d f } xO | D]G } | | j o4 t	 |  | ƒ } t
 | ƒ o t | | | ƒ n n qS Wd S(   sI  Directory 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.Ns   .s   ..(   s   oss   listdirs   tops   namess   errors   funcs   args
   exceptionss   names   joins   isdirs   walk(   s   tops   funcs   args   namess
   exceptionss   name(    (    s   /usr/lib/python2.2/dospath.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 |  Sn t i d } n |  S| |  | Sd S(   sä  Expand paths beginning with '~' or '~user'.
    '~' means $HOME; '~user' means that user's home directory.
    If the path doesn't begin with '~', or if the user or $HOME is unknown,
    the path is returned unchanged (leaving error reporting to whatever
    function is called with the expanded path as argument).
    See also module 'glob' for expansion of *, ? and [...] in pathnames.
    (A function should also be defined to do full *sh-style environment
    variable expansion.)i   s   ~s   /\s   HOMEN(   s   paths   lens   is   ns   oss   environs   has_keys   userhome(   s   paths   userhomes   is   n(    (    s   /usr/lib/python2.2/dospath.pys
   expanduserÕ s      c    sœ  d |  j o |  Sn d k } | i | i d } d } d } t |  ƒ } xG| | j  o9|  | } | d j oq |  | d }  t |  ƒ } y) |  i d ƒ } | d |  | d  } Wn' t
 j
 o | |  } | d } n Xn¤| d j oŒ|  | d | d !d j o | | } | d } nU|  | d | d !d	 j o |  | d }  t |  ƒ } yE |  i d
 ƒ } |  |  } t i i | ƒ o | t i | } n Wn' t
 j
 o | |  } | d } n Xn¬ d } | d } |  | | d !} xD | d j o
 | | j o) | | } | d } |  | | d !} qðWt i i | ƒ o | t i | } n | d j o | | } n n | | } | d } qM W| Sd S(   s:  Expand paths containing shell variable substitutions.
    The following rules apply:
        - no expansion within single quotes
        - no escape character, except for '$$' which is translated into '$'
        - ${varname} is accepted.
        - varnames can be made out of letters, digits and the character '_'s   $Ns   _-s    i    s   'i   i   s   {s   }(   s   paths   strings   ascii_letterss   digitss   varcharss   ress   indexs   lens   pathlens   cs
   ValueErrors   vars   oss   environs   has_key(   s   paths   indexs   cs   strings   ress   varcharss   pathlens   var(    (    s   /usr/lib/python2.2/dospath.pys
   expandvarsí sd     	 





 


c    sÿ  |  i d d ƒ }  t |  ƒ \ } }  x* |  d  d j o | d } |  d }  q' W|  i d ƒ } d } x`| t | ƒ j  oL| | d j o | | =n-| | d j o% | d j o | | d d d f j o  | | d | d 5| d } nÔ | | d j o | d j o | | d d j o | | =n– d | | j oC | | i d ƒ } | d d  d | d d	  | | <| d } nB t | | ƒ d j o  | | d  | | <| d } n | d } qi W| o | o | i	 d ƒ n | d i
 | ƒ Sd
 S(   sŠ   Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A/B.
    Also, components of the path are silently truncated to 8+3 notation.s   /s   \i   i    s   .s   ..s    i   i   N(   s   paths   replaces
   splitdrives   prefixs   splits   compss   is   lens   comps   appends   join(   s   paths   compss   prefixs   comps   i(    (    s   /usr/lib/python2.2/dospath.pys   normpath*s:      
 93"c    s5   t  |  ƒ o t t i ƒ  |  ƒ }  n t |  ƒ Sd S(   s   Return an absolute path.N(   s   isabss   paths   joins   oss   getcwds   normpath(   s   path(    (    s   /usr/lib/python2.2/dospath.pys   abspathNs     (   s   __doc__s   oss   stats   __all__s   normcases   isabss   joins
   splitdrives   splits   splitexts   basenames   dirnames   commonprefixs   getsizes   getmtimes   getatimes   islinks   existss   isdirs   isfiles   ismounts   walks
   expandusers
   expandvarss   normpaths   abspaths   realpath(   s   realpaths   stats   commonprefixs   existss   splitexts   basenames   normcases   walks
   expandvarss
   expandusers   getmtimes   getatimes   dirnames   isfiles   isdirs   getsizes   joins   __all__s   isabss   normpaths   ismounts
   splitdrives   splits   oss   abspaths   islink(    (    s   /usr/lib/python2.2/dospath.pys   ? s4   		H				
											
	
				=	$	