3 ig@spddlZddlZddlZddlZddlmZddlmZe ee dddZ e e dd d Z e e dd d Z dS) N)Optional)WINDOWS)urlreturncCs d|kr dS|jdddjS)N:rr)splitlower)rr 7/tmp/pip-build-88gy_88q/pip/pip/_internal/utils/urls.pyget_url_scheme sr )pathrcCs.tjjtjj|}tjjdtjj|}|S)zh Convert a path to a file: URL. The path will be made absolute and have quoted path parts. zfile:) osr normpathabspathurllibparseurljoinrequest pathname2url)r rr r r path_to_urlsrcCs|jdstd|dtjj|\}}}}}| s>|dkrDd}ntrRd|}ntd|tjj||}tr| rt |dkr|d d kr|d t j kr|d d dkr|d d}|S)z( Convert a file: URL to a path. zfile:z1You can only turn file: urls into filenames (not ) localhostz\\z8non-local file URIs are not supported on this platform: r/rr:/N)rr) startswithAssertionErrorrrurlsplitr ValueErrorr url2pathnamelenstring ascii_letters)r_netlocr r r r url_to_paths&     r)) rr% urllib.parserurllib.requestZtypingrcompatrstrr rr)r r r r s