Ńň
mČKc           @   sj   d  Z  d d k Z d 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.i˙˙˙˙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   :(   R   s   ..(   t   urllibt	   splittypet   RuntimeErrort   splitt   lent   joint   unquote(   t   pathnamet   tpt
   componentst   it   rv(    (    s!   /usr/lib/python2.6/macurl2path.pyR    
   s:     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	 |  S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
   t   rangeR   t   mapt   _pncomp2urlt   ost   patht   isabsR   (   R   R   R   (    (    s!   /usr/lib/python2.6/macurl2path.pyR   4   s     c         C   s   t  i |  d  d d }  |  S(   Ni   t   safeR   (   R   t   quote(   t	   component(    (    s!   /usr/lib/python2.6/macurl2path.pyR   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(   R    R   (   t   urlR   (    (    s!   /usr/lib/python2.6/macurl2path.pyt   testO   s"      t   __main__(	   t   __doc__R   R   t   __all__R    R   R   R   t   __name__(    (    (    s!   /usr/lib/python2.6/macurl2path.pyt   <module>   s   	*			