a  ze@sTddlZddlZddlZddlZddlmZddlmZddZ ddZ d d Z dS) N)Optional)WINDOWScCs d|vr dS|dddS)N:rr)splitlower)urlr Z/opt/bitninja-python-dojo/embedded/lib/python3.9/site-packages/pip/_internal/utils/urls.pyget_url_scheme sr cCs.tjtj|}tjdtj|}|S)zh Convert a path to a file: URL. The path will be made absolute and have quoted path parts. file:) ospathnormpathabspathurllibparseurljoinrequest pathname2url)rrr r r path_to_urlsrcCs|dsJd|dtj|\}}}}}|r<|dkrBd}ntrPd|}ntd|tj||}tr|st|dkr|d d kr|d t j vr|d d dvr|d d}|S)z( Convert a file: URL to a path. r z1You can only turn file: urls into filenames (not ) localhostz\\z8non-local file URIs are not supported on this platform: r/r)rz:/N) startswithrrurlsplitr ValueErrorr url2pathnamelenstring ascii_letters)r_netlocrr r r url_to_paths8       r') r r# urllib.parserurllib.requesttypingrcompatrr rr'r r r r s