ruff.toml: enable ruff ruleset

This commit is contained in:
Jelle van der Waa 2024-05-31 21:23:02 +02:00 committed by Jelle van der Waa
parent bee08575b7
commit a27d5c3067
5 changed files with 7 additions and 6 deletions

View File

@ -246,7 +246,7 @@ def get_requiredby(self):
# sort out duplicate packages; this happens if something has a double
# versioned depend such as a kernel module
requiredby = [list(vals)[0] for _, vals in groupby(requiredby, lambda x: x.pkg.id)]
requiredby = [next(iter(vals)) for _, vals in groupby(requiredby, lambda x: x.pkg.id)]
if not requiredby:
return requiredby

View File

@ -23,7 +23,7 @@ class MirrorlistForm(forms.Form):
def __init__(self, *args, **kwargs):
super(MirrorlistForm, self).__init__(*args, **kwargs)
fields = self.fields
fields['country'].choices = [('all', 'All')] + self.get_countries()
fields['country'].choices = [('all', 'All'), *self.get_countries()]
fields['country'].initial = ['all']
protos = [(p.protocol, p.protocol) for p in MirrorProtocol.objects.filter(is_download=True)]
initial = MirrorProtocol.objects.filter(is_download=True, default=True)

View File

@ -54,7 +54,7 @@ class PackageSearchForm(forms.Form):
maintainer = forms.ChoiceField(required=False)
packager = forms.ChoiceField(required=False)
flagged = forms.ChoiceField(
choices=[('', 'All')] + make_choice(['Flagged', 'Not Flagged']),
choices=[('', 'All'), *make_choice(['Flagged', 'Not Flagged'])],
required=False)
def __init__(self, *args, **kwargs):

View File

@ -12,6 +12,7 @@ select = [
"PIE", # flake8-pie
"PLE", # pylint errors
"RSE", # flake8-raise
"RUF", # ruff rules
"T10", # flake8-debugger
"TCH", # flake8-type-checking
"UP032", # f-string
@ -20,4 +21,4 @@ select = [
]
# Never enforce `E501` (line length violations).
ignore = ["E501", "E731", "B904"]
ignore = ["E501", "E731", "B904", "RUF012"]

View File

@ -261,8 +261,8 @@
# Enable the debug toolbar if requested
if DEBUG_TOOLBAR:
MIDDLEWARE = ['debug_toolbar.middleware.DebugToolbarMiddleware'] + list(MIDDLEWARE)
MIDDLEWARE = ['debug_toolbar.middleware.DebugToolbarMiddleware', *list(MIDDLEWARE)]
INSTALLED_APPS = list(INSTALLED_APPS) + ['debug_toolbar']
INSTALLED_APPS = [*list(INSTALLED_APPS), 'debug_toolbar']
# vim: set ts=4 sw=4 et: