Replace parse with a simple regex.

This makes parse obsolete, removing ~1000 LOC.
This commit is contained in:
Oz Tiram
2022-11-19 22:10:25 +01:00
parent 9c63a4a59f
commit 709fbb7773
+4 -3
View File
@@ -2,7 +2,6 @@ import re
from urllib.parse import urlparse
from pipenv.patched.pip._vendor.urllib3 import util as urllib3_util
from pipenv.vendor import parse
requests_session = None # type: ignore
@@ -121,6 +120,8 @@ def proper_case(package_name):
if not r.ok:
raise OSError(f"Unable to find package {package_name} in PyPI repository.")
r = parse.parse("https://pypi.org/pypi/{name}/json", r.url)
good_name = r["name"]
regex = r"https://pypi\.org/pypi/(.*)/json$"
match = re.search(regex, r.url)
good_name = match.group(1)
return good_name