U
    
Ha                     @   sT   d dl Z d dlZd dlZd dlZd dlmZ ddlmZ dd Z	dd Z
d	d
 ZdS )    N)Optional   )WINDOWSc                 C   s    d| krd S |  ddd  S )N:r   r   )splitlower)url r	   </tmp/pip-unpacked-wheel-tx790h60/pip/_internal/utils/urls.pyget_url_scheme
   s    r   c                 C   s.   t jt j| } tjdtj| }|S )zh
    Convert a path to a file: URL.  The path will be made absolute and have
    quoted path parts.
    file:)	ospathnormpathabspathurllibparseurljoinrequestpathname2url)r   r   r	   r	   r
   path_to_url   s    r   c                 C   s   |  dstd| dtj| \}}}}}|r<|dkrBd}ntrPd| }ntd| tj|| }tr|st	|dkr|d	 d
kr|d t
jkr|dd dkr|dd }|S )z(
    Convert a file: URL to a path.
    r   z1You can only turn file: urls into filenames (not )	localhost z\\z8non-local file URIs are not supported on this platform:    r   /r         )r   z:/N)
startswithAssertionErrorr   r   urlsplitr   
ValueErrorr   url2pathnamelenstringascii_letters)r   _netlocr   r	   r	   r
   url_to_path   s8    



r(   )r   r$   urllib.parser   urllib.requesttypingr   compatr   r   r   r(   r	   r	   r	   r
   <module>   s   