B
    \ Çc
  ã               @   s   d Z dd„ Zdd„ ZdS )z˜Convert a NT pathname to a file URL and vice versa.

This module only exists to provide OS-specific code
for urllib.requests, thus do not use directly.
c             C   s   ddl }ddl}|  dd¡} d| kr\| dd… dkr@| dd… } |  d¡}|j d	 |¡¡S |  d¡}t|ƒdks„|d d
 |jkr”d|  }t	|ƒ‚|d d
  
¡ }|d  d¡}|d }x$|D ]}|rÀ|d	 |j |¡ }qÀW | d¡rü|  d¡rü|d	7 }|S )z{OS-specific conversion from a relative URL of the 'file' scheme
    to a file system path; not recommended for general use.é    Nú:ú|é   z////é   ú/ú\éÿÿÿÿz	Bad URL: é   )ÚstringÚurllib.parseÚreplaceÚsplitÚparseZunquoteÚjoinÚlenZascii_lettersÚOSErrorÚupperÚendswith)Zurlr
   ÚurllibÚ
componentsÚcompÚerrorÚdriveÚpath© r   úlib/python3.7/nturl2path.pyÚurl2pathname   s(    	


r   c             C   sÒ   ddl }d| krD| dd… dkr(d|  } |  d¡}|j d |¡¡S |  d¡}t|ƒdksjt|d ƒdkrzd	|  }t|ƒ‚|j |d  ¡ ¡}|d  d¡}d
| d }x$|D ]}|r®|d |j |¡ }q®W |S )z{OS-specific conversion from a file system path to a relative URL
    of the 'file' scheme; not recommended for general use.r   Nr   r   z\\r   r   r	   z
Bad path: z///)r   r   r   Zquoter   r   r   r   )Úpr   r   r   r   r   r   r   r   r   Úpathname2url-   s"    


r   N)Ú__doc__r   r   r   r   r   r   Ú<module>   s   %