3

†¸gÉ  ã               @   sh   d dl Z d dlZd dlmZ d dlmZ d dlmZ erLd dl	m
Z
mZmZ dd„ Zdd	„ Zd
d„ ZdS )é    N)Úparse)Úrequest)ÚMYPY_CHECK_RUNNING)ÚOptionalÚTextÚUnionc             C   s    d| krd S | j ddƒd jƒ S )Nú:é   r   )ÚsplitÚlower)Úurl© r   ú</tmp/pip-unpacked-wheel-v59g9nu1/pip/_internal/utils/urls.pyÚget_url_scheme   s    r   c             C   s*   t jjt j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.
    zfile:)ÚosÚpathÚnormpathÚabspathÚurllib_parseÚurljoinÚurllib_requestÚpathname2url)r   r   r   r   r   Úpath_to_url   s    r   c             C   sp   | j dƒstd|  ƒ‚tj| ƒ\}}}}}| s8|dkr>d}n tjdkrRd| }ntd|  ƒ‚tj|| ƒ}|S )z(
    Convert a file: URL to a path.
    zfile:z4You can only turn file: urls into filenames (not %r)Ú	localhostÚ Úwin32z\\z:non-local file URIs are not supported on this platform: %r)	Ú
startswithÚAssertionErrorr   ÚurlsplitÚsysÚplatformÚ
ValueErrorr   Úurl2pathname)r   Ú_Únetlocr   r   r   r   Úurl_to_path   s    


r%   )r   r   Úpip._vendor.six.moves.urllibr   r   r   r   Úpip._internal.utils.typingr   Útypingr   r   r   r   r   r%   r   r   r   r   Ú<module>   s   