3
rY]	                 @   s   d Z dd Zdd ZdS )z3Convert a NT pathname to a file URL and vice versa.c             C   s  ddl }ddl}| jdd} d| kr\| dd dkr@| dd } | jd}|jjd	j|S | jd}t|dks|d d |jkrd|  }t	||d d j
 }|d
 jd}|d }x$|D ]}|r|d	 |jj| }qW |jdo| j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: r	   )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.6/nturl2path.pyurl2pathname   s(    	


r   c             C   s   ddl }d| krD| dd dkr(d|  } | jd}|jjdj|S | jd}t|dksjt|d dkrzd	|  }t||jj|d j }|d jd}d
| d }x$|D ]}|r|d |jj| }qW |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   %