Remove flake8 W503 issues

This commit is contained in:
Jelle van der Waa 2021-09-20 08:46:13 +02:00
parent 1c16824206
commit f8a5ec056e
No known key found for this signature in database
GPG Key ID: C06086337C50773E
4 changed files with 5 additions and 13 deletions

View File

@ -1,3 +1,3 @@
[flake8]
max-line-length = 300
ignore = E731, E241, W503, E741
ignore = E731, E241, E741

View File

@ -280,8 +280,7 @@ def grouper(depend):
dep_pkgs = list(dep_pkgs)
dep = dep_pkgs[0]
if len(dep_pkgs) > 1:
dep_pkgs = [d for d in dep_pkgs if d.pkg.repo.testing == self.repo.testing
and d.pkg.repo.staging == self.repo.staging]
dep_pkgs = [d for d in dep_pkgs if d.pkg.repo.testing == self.repo.testing and d.pkg.repo.staging == self.repo.staging]
if len(dep_pkgs) > 0:
dep = dep_pkgs[0]
trimmed.append(dep)

View File

@ -253,9 +253,7 @@ def log_update(self, old_pkg, new_pkg):
if new_pkg:
update.action_flag = CHANGE
# ensure we should even be logging this
if (old_pkg.pkgver == new_pkg.pkgver
and old_pkg.pkgrel == new_pkg.pkgrel
and old_pkg.epoch == new_pkg.epoch):
if old_pkg.pkgver == new_pkg.pkgver and old_pkg.pkgrel == new_pkg.pkgrel and old_pkg.epoch == new_pkg.epoch:
# all relevant fields were the same; e.g. a force update
return
else:
@ -397,8 +395,7 @@ def get_best_satisfier(self):
# actually satisfy the requirements
if self.comparison and self.version:
alpm = AlpmAPI()
pkgs = [pkg for pkg in pkgs if not alpm.available
or alpm.compare_versions(pkg.full_version, self.comparison, self.version)]
pkgs = [pkg for pkg in pkgs if not alpm.available or alpm.compare_versions(pkg.full_version, self.comparison, self.version)]
if len(pkgs) == 0:
# couldn't find a package in the DB
# it should be a virtual depend (or a removed package)

View File

@ -37,11 +37,7 @@ def clean_message(self):
# make sure the message isn't garbage (only punctuation or whitespace)
# or spam (using a simple denylist)
# and ensure a certain minimum length
if (
re.match(r'^[^0-9A-Za-z]+$', data)
or any(fd.keyword in data for fd in FlagDenylist.objects.all())
or len(data) < 3
):
if re.match(r'^[^0-9A-Za-z]+$', data) or any(fd.keyword in data for fd in FlagDenylist.objects.all()) or len(data) < 3:
raise forms.ValidationError("Enter a valid and useful out-of-date message.")
return data