Fix issues pointed out by ruff

Signed-off-by: Alfred Wingate <parona@protonmail.com>
This commit is contained in:
Alfred Wingate
2023-11-14 23:43:04 +02:00
parent 70f88ed37d
commit a8f35aee25
7 changed files with 20 additions and 22 deletions

View File

@ -27,8 +27,10 @@ def guess_package(cp, url):
if match:
pkg = match.group(1)
try:
# Output is None if input is invalid, therefore TypeError when
# this None is attempted to be unpacked into three variables.
cp, ver, rev = portage.pkgsplit("fake/" + pkg)
except:
except TypeError:
pass
cat, pkg = cp.split("/")
@ -92,7 +94,7 @@ def cpan_mangle_version(pv):
def cpan_vercmp(cp, a, b):
try:
return float(a) - float(b)
except:
except OverflowError:
return helpers.simple_vercmp(a, b)
@ -113,7 +115,7 @@ def scan_pkg(pkg, options):
options["versionmangle"] = ["cpan", "gentoo"]
url = "http://search.cpan.org/api/dist/%s" % remote_pkg
cp, ver, rev = pkg.cp, pkg.version, pkg.revision
cp, ver = pkg.cp, pkg.version
m_ver = cpan_mangle_version(ver)
output.einfo("Using CPAN API: " + url)

View File

@ -4,8 +4,6 @@ import urllib.parse
import urllib.request
import xml.dom.minidom
import portage
from euscan import helpers, mangling, output
HANDLER_NAME = "php"
@ -35,7 +33,7 @@ def scan_url(pkg, url, options):
def scan_pkg(pkg, options):
cp, ver, rev = pkg.cp, pkg.version, pkg.revision
cp, ver = pkg.cp, pkg.version
package = options["data"]
channel = options["type"]