
ÜùnW¬
  ã               @   sR   d  Z  d d l Z d d l Z d d g Z d d „  Z d d „  Z d d „  Z d S)	zqMacintosh-specific module for conversion between pathnames and URLs.

Do not import directly; use urllib instead.é    NÚurl2pathnameÚpathname2urlc             C   sé  t  j j |  ƒ d } | r4 | d k r4 t d ƒ ‚ |  d d … d k r] |  d d … }  n" |  d d … d k r t d ƒ ‚ |  j d	 ƒ } d } xÆ | t | ƒ k  r\| | d
 k rÃ | | =q— | | d k r| d k r| | d d k r| | d | d … =| d } q— | | d k rO| d k rO| | d d k rO| | =q— | d } q— W| d sƒd j | d d … ƒ } nV d } x: | t | ƒ k  rÅ| | d k rÅd | | <| d } qŒWd d j | ƒ } t  j j | ƒ S)z{OS-specific conversion from a relative URL of the 'file' scheme
    to a file system path; not recommended for general use.r   Úfilez(Cannot convert non-local URL to pathnameNé   z///é   z//ú/Ú.ú..é   Ú ú:)r   r	   )ÚurllibÚparseZ	splittypeÚRuntimeErrorÚsplitÚlenÚjoinZunquote)ÚpathnameÚtpÚ
componentsÚiÚrv© r   úR/afs/cs.wisc.edu/s/python-3.5.2/src/amd64_ubu16/../Python-3.5.2/Lib/macurl2path.pyr   
   s6    
0

%
c             C   sÏ   d |  k r t  d ƒ ‚ |  j d ƒ } | d d k r> | d =| d	 d k rU | d
 =x4 t t | ƒ ƒ D]  } | | d k rh d | | <qh Wt t | ƒ } t j j |  ƒ r¾ d d j	 | ƒ Sd j	 | ƒ Sd S)z{OS-specific conversion from a file system path to a relative URL
    of the 'file' scheme; not recommended for general use.r   z*Cannot convert pathname containing slashesr   r   r   r
   z..Néÿÿÿÿr   )
r   r   Úranger   ÚmapÚ_pncomp2urlÚosÚpathÚisabsr   )r   r   r   r   r   r   r   4   s    c             C   s    t  j j |  d  d … d d ƒS)Né   Zsafer   )r   r   Zquote)Z	componentr   r   r   r   K   s    r   )Ú__doc__Zurllib.parser   r   Ú__all__r   r   r   r   r   r   r   Ú<module>   s   *