Remove obsolete Python 2 compatibility code

This commit is contained in:
Dominik Jain authored and Dominik Jain committed 2026-07-17 17:29:33 +02:00
1 parent 1e8e45fa93
commit 369e3a05a0
1 file changed
+2 -12
+2 -12
View File
@@ -345,19 +345,9 @@ class PathUtils:
This method was obtained from https://stackoverflow.com/a/61922504
"""
try:
from urllib.parse import unquote, urlparse
from urllib.request import url2pathname
except ImportError:
# backwards compatibility (Python 2)
from urllib.parse import unquote as unquote_py2
from urllib.request import url2pathname as url2pathname_py2
from urllib.parse import unquote, urlparse
from urllib.request import url2pathname
from urlparse import urlparse as urlparse_py2
unquote = unquote_py2
url2pathname = url2pathname_py2
urlparse = urlparse_py2
parsed = urlparse(uri)
host = f"{os.path.sep}{os.path.sep}{parsed.netloc}{os.path.sep}"
path = os.path.abspath(os.path.join(host, url2pathname(unquote(parsed.path))))