mirror of
https://github.com/tiennm99/serena.git
synced 2026-10-12 20:15:56 +00:00
Remove obsolete Python 2 compatibility code
This commit is contained in:
1 parent
1e8e45fa93
commit
369e3a05a0
1 file changed
+2
-12
@@ -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))))
|
||||
|
||||
Reference in new issue
Block a user