;
Êâ"Ic               @   sj   d  Z  d d l Z d d l Z d d g Z d   Z d   Z d   Z d   Z e	 d	 k o e   n d S(
   uq   Macintosh-specific module for conversion between pathnames and URLs.

Do not import directly; use urllib instead.i    Nu   url2pathnameu   pathname2urlc             C   s  t  j |   d } | o | d k o t d   n |  d d  d k o |  d d  }  n( |  d d  d k o t d   n |  j d	  } d } xÒ | t |  k  oŸ | | d
 k o | | =q¡ | | d k oE | d k o8 | | d d k o# | | d | d  =| d } q¡ | | d k o- | d k o  | | d d k o | | =q¡ | d } q¡ W| d p d j | d d   } nZ d } x= | t |  k  o) | | d k o d | | <| d } q€Wd d j |  } t  j |  S(   u{   OS-specific conversion from a relative URL of the 'file' scheme
    to a file system path; not recommended for general use.i    u   fileu(   Cannot convert non-local URL to pathnameNi   u   ///i   u   //u   /u   .u   ..i   u    u   :(   u    u   ..(   u   urllibu   parsesplittypeu   RuntimeErroru   splitu   lenu   joinu   parseunquote(   u   pathnameu   tpu
   componentsu   iu   rv(    (    u(   /mit/python/lib/python3.0/macurl2path.pyu   url2pathname
   s:     3 $
c             C   så   d |  k o t  d   n |  j d  } | d d k o | d =n | d d k o | d =n x9 t t |   D]% } | | d k o d | | <qw qw Wt t |  } t j j |   o d d j	 |  Sd j	 |  Sd S(	   u{   OS-specific conversion from a file system path to a relative URL
    of the 'file' scheme; not recommended for general use.u   /u*   Cannot convert pathname containing slashesu   :i    u    iÿÿÿÿu   ..N(
   u   RuntimeErroru   splitu   rangeu   lenu   mapu   _pncomp2urlu   osu   pathu   isabsu   join(   u   pathnameu
   componentsu   i(    (    u(   /mit/python/lib/python3.0/macurl2path.pyu   pathname2url4   s     c             C   s   t  j |  d  d  d d S(   Ni   u   safeu    (   u   urllibu
   parsequote(   u	   component(    (    u(   /mit/python/lib/python3.0/macurl2path.pyu   _pncomp2urlK   s    c           
   C   s   x7 d d d d d g D]  }  t  d |  t |   f  q Wx@ d d d	 d
 d d d d g D]  } t  d | t |  f  qY Wd  S(   Nu
   index.htmlu   bar/index.htmlu   /foo/bar/index.htmlu	   /foo/bar/u   /u   %r -> %ru   drive:u
   drive:dir:u   drive:dir:fileu
   drive:fileu   fileu   :fileu   :dir:u	   :dir:file(   u   printu   url2pathnameu   pathname2url(   u   urlu   path(    (    u(   /mit/python/lib/python3.0/macurl2path.pyu   testO   s"      u   __main__(
   u   __doc__u   urllib.parseu   urllibu   osu   __all__u   url2pathnameu   pathname2urlu   _pncomp2urlu   testu   __name__(    (    (    u(   /mit/python/lib/python3.0/macurl2path.pyu   <module>   s   	*			