o ai@svddlZddlZddlZddlZddlmZddlmZde dee fddZ d e de fd d Z de de fd d Z dS)N)Optional)WINDOWSurlreturncCs d|vrdS|dddS)N:rr)splitlower)rr /builddir/build/BUILDROOT/alt-python310-pip-21.3.1-5.el8.x86_64/opt/alt/python310/lib/python3.10/site-packages/pip/_internal/utils/urls.pyget_url_scheme sr pathcCs.tjtj|}tjdtj|}|S)zh Convert a path to a file: URL. The path will be made absolute and have quoted path parts. file:) osr normpathabspathurllibparseurljoinrequest pathname2url)r rr r r path_to_urlsrcCs|ds Jd|dtj|\}}}}}|r|dkr!d}ntr(d|}ntd|tj||}tr\|s\t|dkr\|d d kr\|d t j vr\|d d dvr\|d d}|S)z( Convert a file: URL to a path. rz1You 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_netlocr r r r url_to_paths0      r() rr$ urllib.parserurllib.requesttypingrcompatrstrr rr(r r r r s