From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 74B1615800A for ; Sun, 6 Aug 2023 23:30:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A68EA2BC018; Sun, 6 Aug 2023 23:30:08 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 8ED3C2BC018 for ; Sun, 6 Aug 2023 23:30:08 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id B6CA7340B57 for ; Sun, 6 Aug 2023 23:30:07 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 19B61F1D for ; Sun, 6 Aug 2023 23:30:06 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1691364582.ac250b126b8de24276cd4e9bdc4afab14a9c41e7.sam@gentoo> Subject: [gentoo-commits] proj/mirrorselect:master commit in: mirrorselect/ X-VCS-Repository: proj/mirrorselect X-VCS-Files: mirrorselect/mirrorparser3.py X-VCS-Directories: mirrorselect/ X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: ac250b126b8de24276cd4e9bdc4afab14a9c41e7 X-VCS-Branch: master Date: Sun, 6 Aug 2023 23:30:06 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 073ba356-f8f1-4657-be78-f515cf3c6958 X-Archives-Hash: 4f991fbd28896a86faf18122a20d015d commit: ac250b126b8de24276cd4e9bdc4afab14a9c41e7 Author: Sam James gentoo org> AuthorDate: Sun Aug 6 23:29:25 2023 +0000 Commit: Sam James gentoo org> CommitDate: Sun Aug 6 23:29:42 2023 +0000 URL: https://gitweb.gentoo.org/proj/mirrorselect.git/commit/?id=ac250b12 extractor.py: cleanup py2 compat Bug: https://bugs.gentoo.org/911183 Signed-off-by: Sam James gentoo.org> mirrorselect/mirrorparser3.py | 9 ++------- 1 file 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 '