diff options
author | Sam James <sam@gentoo.org> | 2023-08-07 00:29:25 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-08-07 00:29:42 +0100 |
commit | ac250b126b8de24276cd4e9bdc4afab14a9c41e7 (patch) | |
tree | bf93ffff4b728f256da45cea041128b16d853033 /mirrorselect | |
parent | extractor.py: parse proto from the uri (diff) | |
download | mirrorselect-ac250b126b8de24276cd4e9bdc4afab14a9c41e7.tar.gz mirrorselect-ac250b126b8de24276cd4e9bdc4afab14a9c41e7.tar.bz2 mirrorselect-ac250b126b8de24276cd4e9bdc4afab14a9c41e7.zip |
extractor.py: cleanup py2 compat
Bug: https://bugs.gentoo.org/911183
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'mirrorselect')
-rw-r--r-- | mirrorselect/mirrorparser3.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/mirrorselect/mirrorparser3.py b/mirrorselect/mirrorparser3.py index 444bc11..9bca3e9 100644 --- a/mirrorselect/mirrorparser3.py +++ b/mirrorselect/mirrorparser3.py @@ -48,13 +48,8 @@ class MirrorParser3: if not uri: # Don't parse if empty return None; try: - import sys; - if sys.version_info[0] >= 3: - from urllib.parse import urlparse - return urlparse(uri).scheme - else: - from urllib2 import Request - return Request(uri).get_type() + from urllib.parse import urlparse + return urlparse(uri).scheme except Exception as e: # Add general exception to catch errors from mirrorselect.output import Output Output.write(('_get_proto(): Exception while parsing the protocol ' |