ó
è¾bc           @   sI   d  Z  d d l Z d d l Z d d g Z d „  Z d „  Z d „  Z 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  j |  ƒ d } | r1 | d k r1 t d ‚ n  |  d  d k rN |  d }  n |  d  d k rj t d ‚ n  |  j d ƒ } d } xÃ | t | ƒ k  rD| | d	 k r® | | =q‚ | | d
 k rý | d k rý | | d d k rý | | d | d 5| d } q‚ | | d k r7| d k r7| | d d k r7| | =q‚ | d } q‚ W| d sed j | d ƒ } nV d } x: | t | ƒ k  r§| | d
 k r§d | | <| d } qnWd d j | ƒ } t  j | ƒ 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.7/macurl2path.pyR    
   s6    
0

%
c         C   sØ   d |  k r t  d ‚ n  |  j d ƒ } | d d k rA | d =n  | d d k r[ | d =n  x7 t t | ƒ ƒ D]# } | | d k rn d | | <qn qn Wt t | ƒ } t j j |  ƒ rÇ d d j	 | ƒ Sd j	 | ƒ 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.7/macurl2path.pyR   4   s    

c         C   s   t  j |  d  d d ƒ}  |  S(   Ni   t   safeR   (   R   t   quote(   t	   component(    (    s!   /usr/lib/python2.7/macurl2path.pyR   K   s    (   t   __doc__R   R   t   __all__R    R   R   (    (    (    s!   /usr/lib/python2.7/macurl2path.pyt   <module>   s   	*	