a
    ü`÷  ã                   @   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| vrd S |   dd¡d  ¡ S )Nú:é   r   )ÚsplitÚlower)Úurl© r   ú:/usr/lib/python3/dist-packages/pip/_internal/utils/urls.pyÚget_url_scheme   s    r   c                 C   s*   t j t j | ¡¡} t dt | ¡¡}|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_parseZurljoinÚurllib_requestZpathname2url)r   r   r   r   r   Úpath_to_url   s    r   c                 C   s‚   |   d¡s J djf i tƒ ¤Žƒ‚t | ¡\}}}}}|r@|dkrFd}n*tjdkrZd| }ntdjf i tƒ ¤Žƒ‚t 	|| ¡}|S )z(
    Convert a file: URL to a path.
    r   z9You can only turn file: urls into filenames (not {url!r})Z	localhostÚ Zwin32z\\z?non-local file URIs are not supported on this platform: {url!r})
Ú
startswithÚformatÚlocalsr   ZurlsplitÚsysÚplatformÚ
ValueErrorr   Zurl2pathname)r   Ú_Znetlocr   r   r   r   Úurl_to_path   s"    ÿÿ

ÿÿr    )r   r   Zpip._vendor.six.moves.urllibr   r   r   r   Zpip._internal.utils.typingr   Útypingr   r   r   r   r   r    r   r   r   r   Ú<module>   s   