mò
­fIc           @   sd   d  Z  d k Z d k Z d d g Z d „  Z d „  Z d „  Z d „  Z e d j o e ƒ  n d S(	   sq   Macintosh-specific module for conversion between pathnames and URLs.

Do not import directly; use urllib instead.Nt   url2pathnamet   pathname2urlc         C   sà  t  i |  ƒ d } | o | d j o t d ‚ n |  d  d j o |  d }  n |  d  d j o t d ‚ n |  i d ƒ } d } xÏ | t | ƒ j  o» | | d	 j o | | =q‰ | | d
 j oB | d j o5 | | d d j o  | | d | d 5| d } q‰ | | d j o- | d j o  | | d d j o | | =q‰ | d } q‰ W| d p d i	 | d ƒ } nZ d } x= | t | ƒ j  o) | | d
 j o d | | <| d } qƒWd d i	 | ƒ } t  i | ƒ S(   s{   OS-specific conversion from a relative URL of the 'file' scheme
    to a file system path; not recommended for general use.i    t   files(   Cannot convert non-local URL to pathnamei   s   ///i   s   //t   /t   .s   ..i   t    t   :N(   R   s   ..(   t   urllibt	   splittypet   pathnamet   tpt   RuntimeErrort   splitt
   componentst   it   lent   joint   rvt   unquote(   R	   R   R   R
   R   (    (    t(   /mit/python/lib/python2.4/macurl2path.pyR    
   s:      33 $
c         C   så   d |  j o t d ‚ n |  i d ƒ } | d d j o | d =n | d d j o | d =n x9 t t | ƒ ƒ D]% } | | d j o d | | <qt qt Wt t | ƒ } t	 i
 i |  ƒ o d d i | ƒ Sn d i | ƒ Sd S(	   s{   OS-specific conversion from a file system path to a relative URL
    of the 'file' scheme; not recommended for general use.R   s*   Cannot convert pathname containing slashesR   i    R   iÿÿÿÿs   ..N(   R	   R   R   R   t   rangeR   R   t   mapt   _pncomp2urlt   ost   patht   isabsR   (   R	   R   R   (    (    R   R   4   s       c         C   s   t  i |  d  d d ƒ}  |  S(   Ni   t   safeR   (   R   t   quotet	   component(   R   (    (    R   R   K   s    c          C   sw   x2 d d d d d g D] }  d |  t |  ƒ f GHq Wx; d d d	 d
 d d d d g D] } d | t | ƒ f GHqT Wd  S(   Ns
   index.htmls   bar/index.htmls   /foo/bar/index.htmls	   /foo/bar/R   s   %r -> %rs   drive:s
   drive:dir:s   drive:dir:files
   drive:fileR   s   :files   :dir:s	   :dir:file(   t   urlR    R   R   (   R   R   (    (    R   t   testO   s      t   __main__(	   t   __doc__R   R   t   __all__R    R   R   R   t   __name__(   R!   R   R   R   R   R   R    (    (    R   t   ?   s   			*			