ó
è¾bc           @   s   d  Z  d „  Z d „  Z d S(   s3   Convert a NT pathname to a file URL and vice versa.c         C   sW  d d l  } d d l } |  j d d ƒ }  d |  k rx |  d  d k rS |  d }  n  |  j d ƒ } | j d	 j | ƒ ƒ S|  j d ƒ } t | ƒ d k s° | d
 d | j k rÆ d |  } t | ‚ n  | d
 d j	 ƒ  } | d } | d j d ƒ } x. | D]& } | rþ | d	 | j | ƒ } qþ qþ W| j
 d ƒ rS|  j
 d ƒ rS| d	 7} n  | S(   s{   OS-specific conversion from a relative URL of the 'file' scheme
    to a file system path; not recommended for general use.iÿÿÿÿNt   :t   |i   s   ////i   t   /s   \i    s	   Bad URL: i   (   t   stringt   urllibt   replacet   splitt   unquotet   joint   lent   ascii_letterst   IOErrort   uppert   endswith(   t   urlR   R   t
   componentst   compt   errort   drivet   path(    (    s    /usr/lib/python2.7/nturl2path.pyt   url2pathname   s(    	)

c         C   s  d d l  } d |  k rZ |  d  d k r5 d |  }  n  |  j d ƒ } | j d j | ƒ ƒ S|  j d ƒ } t | ƒ d k s‘ t | d ƒ d	 k r§ d
 |  } t | ‚ n  | j | d j ƒ  ƒ } | d	 j d ƒ } d | d } x. | D]& } | rè | d | j | ƒ } qè qè W| S(   s{   OS-specific conversion from a file system path to a relative URL
    of the 'file' scheme; not recommended for general use.iÿÿÿÿNR    i   s   \\s   \R   i    i   s
   Bad path: s   ///(   R   R   t   quoteR   R	   R   R   (   t   pR   R   R   R   R   R   (    (    s    /usr/lib/python2.7/nturl2path.pyt   pathname2url(   s"    (
N(   t   __doc__R   R   (    (    (    s    /usr/lib/python2.7/nturl2path.pyt   <module>   s   	%