ó
Ð²Ebc           @   sŒ   d  d l  Z  d  d l Z d  d l m Z d  d l m Z d  d l m Z e rm d  d l	 m
 Z
 m Z m Z n  d „  Z d „  Z d „  Z d S(	   iÿÿÿÿN(   t   parse(   t   request(   t   MYPY_CHECK_RUNNING(   t   Optionalt   Textt   Unionc         C   s*   d |  k r d  S|  j d d ƒ d j ƒ  S(   Nt   :i   i    (   t   Nonet   splitt   lower(   t   url(    (    s5   /tmp/pip-build-UPPWic/pip/pip/_internal/utils/urls.pyt   get_url_scheme   s    c         C   s=   t  j j t  j j |  ƒ ƒ }  t j d t j |  ƒ ƒ } | S(   sh   
    Convert a path to a file: URL.  The path will be made absolute and have
    quoted path parts.
    s   file:(   t   ost   patht   normpatht   abspatht   urllib_parset   urljoint   urllib_requestt   pathname2url(   R   R
   (    (    s5   /tmp/pip-build-UPPWic/pip/pip/_internal/utils/urls.pyt   path_to_url   s    c         C   s¬   |  j  d ƒ s' t d j t ƒ    ƒ ‚ t j |  ƒ \ } } } } } | sX | d k ra d } n4 t j d k r} d | } n t d j t ƒ    ƒ ‚ t	 j
 | | ƒ } | S(   s(   
    Convert a file: URL to a path.
    s   file:s9   You can only turn file: urls into filenames (not {url!r})t	   localhostt    t   win32s   \\s?   non-local file URIs are not supported on this platform: {url!r}(   t
   startswitht   AssertionErrort   formatt   localsR   t   urlsplitt   syst   platformt
   ValueErrorR   t   url2pathname(   R
   t   _t   netlocR   (    (    s5   /tmp/pip-build-UPPWic/pip/pip/_internal/utils/urls.pyt   url_to_path   s    	(   R   R   t   pip._vendor.six.moves.urllibR    R   R   R   t   pip._internal.utils.typingR   t   typingR   R   R   R   R   R#   (    (    (    s5   /tmp/pip-build-UPPWic/pip/pip/_internal/utils/urls.pyt   <module>   s   		