diff --git a/devel/management/commands/archweb_inotify.py b/devel/management/commands/archweb_inotify.py
index 4ce441e0..cedfbab8 100644
--- a/devel/management/commands/archweb_inotify.py
+++ b/devel/management/commands/archweb_inotify.py
@@ -71,7 +71,8 @@ def run():
retry = False
except OperationalError as exc:
retry_count += 1
- logger.error('Unable to update database \'%s\', retrying=%d', self.path, retry_count, exc_info=exc)
+ logger.error('Unable to update database \'%s\', retrying=%d',
+ self.path, retry_count, exc_info=exc)
time.sleep(5)
if retry_count == self.retry_limit:
diff --git a/devel/management/commands/readlinks_inotify.py b/devel/management/commands/readlinks_inotify.py
index 24ea0c04..3e4bf529 100644
--- a/devel/management/commands/readlinks_inotify.py
+++ b/devel/management/commands/readlinks_inotify.py
@@ -89,7 +89,9 @@ def setup_notifier(self):
for name in all_paths:
manager.add_watch(name, mask)
- handler = EventHandler(arch_paths=arch_path_map, filename_suffix='.links.tar.gz', callback_func=wrapper_read_links)
+ handler = EventHandler(arch_paths=arch_path_map,
+ filename_suffix='.links.tar.gz',
+ callback_func=wrapper_read_links)
return pyinotify.Notifier(manager, handler)
diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py
index 78ba5501..318c5b93 100644
--- a/devel/management/commands/reporead.py
+++ b/devel/management/commands/reporead.py
@@ -539,7 +539,9 @@ def parse_info(pkgname, filename, iofile):
elif blockname:
store[blockname].append(line)
else:
- raise Exception("%s: Read package info outside a block while reading from %s: %s" % (pkgname, filename, line))
+ raise Exception("%s: Read package info outside a block while reading from %s: %s" % (pkgname,
+ filename,
+ line))
return store
diff --git a/devel/models.py b/devel/models.py
index 64b53998..f8d37df4 100644
--- a/devel/models.py
+++ b/devel/models.py
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
import zoneinfo
+
from django.contrib.auth.models import Group, User
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
diff --git a/devel/reports.py b/devel/reports.py
index 12f96b8e..cb6a2ba5 100644
--- a/devel/reports.py
+++ b/devel/reports.py
@@ -202,7 +202,8 @@ def non_existing_dependencies(packages):
def non_reproducible_packages(packages):
- statuses = RebuilderdStatus.objects.select_related().filter(status=RebuilderdStatus.BAD, pkg__pkgname__in=packages.values('pkgname'))
+ statuses = RebuilderdStatus.objects.select_related().filter(status=RebuilderdStatus.BAD,
+ pkg__pkgname__in=packages.values('pkgname'))
return linkify_non_reproducible_packages(statuses)
@@ -227,7 +228,7 @@ def orphan_dependencies(packages):
JOIN packages_packagerelation ppr ON pp.pkgbase = ppr.pkgbase
JOIN (SELECT DISTINCT cp.pkgname FROM packages cp LEFT JOIN packages_packagerelation pr ON cp.pkgbase = pr.pkgbase WHERE pr.id IS NULL) child ON ppd.name = child.pkgname
ORDER BY child.pkgname;
- """
+ """ # noqa: E501
cursor.execute(query)
for row in cursor.fetchall():
diff --git a/devel/views.py b/devel/views.py
index c151445e..f0d639ee 100644
--- a/devel/views.py
+++ b/devel/views.py
@@ -216,7 +216,9 @@ def tier0_mirror_auth(request):
token = credentials[1]
groups = Group.objects.filter(name__in=SELECTED_GROUPS)
- user = User.objects.filter(username=username, is_active=True, groups__in=groups).select_related('userprofile').first()
+ user = User.objects.filter(username=username,
+ is_active=True,
+ groups__in=groups).select_related('userprofile').first()
if not user:
return unauthorized
diff --git a/main/storage.py b/main/storage.py
index cb22de50..61779337 100644
--- a/main/storage.py
+++ b/main/storage.py
@@ -1,9 +1,10 @@
-import cssmin
import jsmin
from django.contrib.staticfiles.storage import ManifestStaticFilesStorage
from django.core.files.base import ContentFile
from django.utils.encoding import smart_str
+import cssmin
+
class MinifiedStaticFilesStorage(ManifestStaticFilesStorage):
"""
diff --git a/main/templatetags/pgp.py b/main/templatetags/pgp.py
index d15a6498..610a5754 100644
--- a/main/templatetags/pgp.py
+++ b/main/templatetags/pgp.py
@@ -35,7 +35,7 @@ def pgp_dev_key_link(key_id):
key_id = pad_key_id(key_id)
if not key_id:
return "Unknown"
- link_text = (''.join((f'{key_id[i:i+4]}' for i in range(0, len(key_id), 4))))
+ link_text = (''.join((f'{key_id[i:i + 4]}' for i in range(0, len(key_id), 4))))
link_text = f'
{link_text}
'
return pgp_key_link(key_id, link_text)
@@ -51,7 +51,9 @@ def pgp_key_link(key_id, link_text=None):
return format_key(key_id)
pgp_server_secure = getattr(settings, 'PGP_SERVER_SECURE', False)
scheme = 'https' if pgp_server_secure else 'http'
- url = '%s://%s/pks/lookup?op=vindex&fingerprint=on&exact=on&search=0x%s' % (scheme, pgp_server, key_id)
+ url = '%s://%s/pks/lookup?op=vindex&fingerprint=on&exact=on&search=0x%s' % (scheme,
+ pgp_server,
+ key_id)
if link_text is None:
link_text = '0x%s' % key_id[-8:]
values = (url, format_key(key_id), link_text)
diff --git a/news/views.py b/news/views.py
index 20c290c3..33ad1aa5 100644
--- a/news/views.py
+++ b/news/views.py
@@ -54,10 +54,12 @@ def form_valid(self, form):
if settings.MAILMAN_PASSWORD:
headers['Approved'] = settings.MAILMAN_PASSWORD
template = loader.get_template('news/news_email_notification.txt')
+ author = newsitem.author.get_full_name()
+ from_ = f'"Arch Linux: Recent news updates: {author}" <{settings.ANNOUNCE_EMAIL}>'
EmailMessage(
subject=f'[arch-announce] {newsitem.title}',
body=template.render(ctx),
- from_email=f'"Arch Linux: Recent news updates: {newsitem.author.get_full_name()}" <{settings.ANNOUNCE_EMAIL}>',
+ from_email=from_,
to=[settings.ANNOUNCE_EMAIL],
headers=headers).send()
return super(NewsCreateView, self).form_valid(form)
diff --git a/packages/management/commands/populate_signoffs.py b/packages/management/commands/populate_signoffs.py
index 25dc6a90..6e6c0f4c 100644
--- a/packages/management/commands/populate_signoffs.py
+++ b/packages/management/commands/populate_signoffs.py
@@ -53,7 +53,8 @@ def create_specification(package, log, finder):
def get_tag_info(repo, pkgbase, version):
- # Gitlab requires the path to the gitlab repo to be html encoded and project name encoded in a different special way
+ # Gitlab requires the path to the gitlab repo to be html encoded and
+ # project name encoded in a different special way
pkgrepo = urllib.parse.quote_plus(f'{settings.GITLAB_PACKAGE_REPO}/') + gitlab_project_name_to_path(pkgbase)
url = f'https://{settings.GITLAB_INSTANCE}/api/v4/projects/{pkgrepo}/repository/tags'
@@ -112,7 +113,8 @@ def cleanup_signoff_comments():
id_signoffs = [signoff.id for g in groups for signoff in g.signoffs]
logger.info("Keeping %s signoffs", len(id_signoffs))
# FakeSignoffSpecification's have no id
- id_signoffspecs = [g.specification.id for g in groups if not isinstance(g.specification, FakeSignoffSpecification)]
+ id_signoffspecs = [g.specification.id for g in groups if not isinstance(g.specification,
+ FakeSignoffSpecification)]
logger.info("Keeping %s signoffspecifications", len(id_signoffspecs))
Signoff.objects.exclude(id__in=id_signoffs).delete()
diff --git a/packages/models.py b/packages/models.py
index 6b2d28a2..24f84ecd 100644
--- a/packages/models.py
+++ b/packages/models.py
@@ -253,7 +253,8 @@ 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:
@@ -395,7 +396,8 @@ 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)
diff --git a/packages/views/__init__.py b/packages/views/__init__.py
index 75f57e76..f3b39247 100644
--- a/packages/views/__init__.py
+++ b/packages/views/__init__.py
@@ -140,8 +140,14 @@ def sonames(request):
name = request.GET.get('name')
if name:
- sonames = Soname.objects.filter(name__startswith=name).values('pkg__pkgname', 'pkg__pkgver', 'pkg__pkgrel', 'pkg__epoch', 'pkg__repo__name')
- packages = [{'pkgname': soname['pkg__pkgname'], 'pkgrel': soname['pkg__pkgrel'], 'pkgver': soname['pkg__pkgver'], 'epoch': soname['pkg__epoch'], 'repo': soname['pkg__repo__name'].lower()} for soname in sonames]
+ sonames = Soname.objects.filter(name__startswith=name).values('pkg__pkgname',
+ 'pkg__pkgver',
+ 'pkg__pkgrel',
+ 'pkg__epoch',
+ 'pkg__repo__name')
+ packages = [{'pkgname': soname['pkg__pkgname'], 'pkgrel': soname['pkg__pkgrel'],
+ 'pkgver': soname['pkg__pkgver'], 'epoch': soname['pkg__epoch'],
+ 'repo': soname['pkg__repo__name'].lower()} for soname in sonames]
else:
return HttpResponseBadRequest('name parameter is required')
diff --git a/packages/views/flag.py b/packages/views/flag.py
index 3c63d77c..67b2c27d 100644
--- a/packages/views/flag.py
+++ b/packages/views/flag.py
@@ -38,7 +38,8 @@ 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
diff --git a/public/views.py b/public/views.py
index 6c2c8bab..196b5ac4 100644
--- a/public/views.py
+++ b/public/views.py
@@ -92,8 +92,9 @@ def feeds(request):
@cache_control(max_age=307)
def keys(request):
profile_ids = UserProfile.allowed_repos.through.objects.values('userprofile_id')
- users = User.objects.filter(
- is_active=True, userprofile__id__in=profile_ids).order_by('first_name', 'last_name').select_related('userprofile')
+ users = User.objects.filter(is_active=True,
+ userprofile__id__in=profile_ids).order_by('first_name',
+ 'last_name').select_related('userprofile')
user_key_ids = frozenset(user.userprofile.pgp_key[-16:] for user in users
if user.userprofile.pgp_key)
diff --git a/releng/urls.py b/releng/urls.py
index c649cba4..fe0c9cd0 100644
--- a/releng/urls.py
+++ b/releng/urls.py
@@ -9,8 +9,10 @@
releases_patterns = [
path('', ReleaseListView.as_view(), name='releng-release-list'),
path('json/', views.releases_json, name='releng-release-list-json'),
- re_path(r'^(?P[-.\w]+)/$', cache_page(311)(ReleaseDetailView.as_view()), name='releng-release-detail'),
- re_path(r'^(?P[-.\w]+)/torrent/$', cache_page(311)(views.release_torrent), name='releng-release-torrent'),
+ re_path(r'^(?P[-.\w]+)/$', cache_page(311)(ReleaseDetailView.as_view()),
+ name='releng-release-detail'),
+ re_path(r'^(?P[-.\w]+)/torrent/$', cache_page(311)(views.release_torrent),
+ name='releng-release-torrent'),
]
netboot_patterns = [
diff --git a/ruff.toml b/ruff.toml
index 71e20fe2..2e87966a 100644
--- a/ruff.toml
+++ b/ruff.toml
@@ -24,7 +24,6 @@ select = [
]
ignore = [
- "E501", # line lengt violation
"E731", # Do not assign a `lambda` expression, use a `def`
"B904", # Within an `except` clause, raise exceptions with `raise ... from err`
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
@@ -34,3 +33,8 @@ ignore = [
"DJ008", # Model does not define `__str__` method
"DJ012", # Order of model's inner classes, methods, and fields does not follow the Django Style Guide: `Meta` class should come before `get_absolute_url`
]
+
+# Ignore Django migrations
+exclude = [
+ "*/migrations/*.py"
+]
diff --git a/settings.py b/settings.py
index 8f428fc6..928e83f5 100644
--- a/settings.py
+++ b/settings.py
@@ -266,7 +266,9 @@
INSTALLED_APPS = [*list(INSTALLED_APPS), 'debug_toolbar']
if PROMETHEUS_METRICS:
- MIDDLEWARE = ['django_prometheus.middleware.PrometheusBeforeMiddleware', *list(MIDDLEWARE), 'django_prometheus.middleware.PrometheusAfterMiddleware']
+ MIDDLEWARE = ['django_prometheus.middleware.PrometheusBeforeMiddleware',
+ *list(MIDDLEWARE),
+ 'django_prometheus.middleware.PrometheusAfterMiddleware']
INSTALLED_APPS = [*list(INSTALLED_APPS), 'django_prometheus']