*: pylint: Avoid calling super() with arguments

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa 2022-06-22 19:45:06 -07:00 committed by James Valleroy
parent bfa11beb73
commit 22a120d979
No known key found for this signature in database
GPG Key ID: 77C0C75E7B650808
12 changed files with 33 additions and 35 deletions

View File

@ -17,6 +17,6 @@ class DelugeForm(DirectorySelectForm):
def __init__(self, *args, **kw):
validator = DirectoryValidator(username=SYSTEM_USER,
check_creatable=True)
super(DelugeForm, self).__init__(title=_('Download directory'),
default='/var/lib/deluged/Downloads',
validator=validator, *args, **kw)
super().__init__(title=_('Download directory'),
default='/var/lib/deluged/Downloads',
validator=validator, *args, **kw)

View File

@ -167,7 +167,7 @@ class GenericForm(ConnectionForm):
def __init__(self, *args, **kwargs):
"""Initialize the form, populate interface choices."""
super(GenericForm, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
choices = self._get_interface_choices(nm.DeviceType.GENERIC)
self.fields['interface'].choices = choices
@ -183,7 +183,7 @@ class EthernetForm(ConnectionForm):
def __init__(self, *args, **kwargs):
"""Initialize the form, populate interface choices."""
super(EthernetForm, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
choices = self._get_interface_choices(nm.DeviceType.ETHERNET)
self.fields['interface'].choices = choices
@ -278,7 +278,7 @@ requires clients to have the password to connect.'),
def __init__(self, *args, **kwargs):
"""Initialize the form, populate interface choices."""
super(WifiForm, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
choices = self._get_interface_choices(nm.DeviceType.WIFI)
self.fields['interface'].choices = choices

View File

@ -22,7 +22,7 @@ class TrimmedCharField(forms.CharField):
if value:
value = value.strip()
return super(TrimmedCharField, self).clean(value)
return super().clean(value)
class ConfigurationForm(forms.Form):
@ -155,7 +155,7 @@ class AddCustomServiceForm(BaseCustomServiceForm):
return match_found
def clean(self):
cleaned_data = super(AddCustomServiceForm, self).clean()
cleaned_data = super().clean()
try:
is_predefined = self.matches_predefined_service(cleaned_data)
except KeyError:

View File

@ -62,4 +62,4 @@ class ConfigurationView(AppView):
def form_valid(self, form):
form.save(self.request)
return super(ConfigurationView, self).form_valid(form)
return super().form_valid(form)

View File

@ -29,7 +29,7 @@ class TrimmedCharField(forms.CharField):
if value:
value = value.strip()
return super(TrimmedCharField, self).clean(value)
return super().clean(value)
class ShadowsocksForm(forms.Form):

View File

@ -55,7 +55,7 @@ class AddShareForm(forms.Form):
def clean(self):
"""Check that at least one group is added for non-public shares."""
super(AddShareForm, self).clean()
super().clean()
is_public = self.cleaned_data.get('is_public')
groups = self.cleaned_data.get('groups')
if not is_public and not groups:

View File

@ -53,7 +53,7 @@ class SSOLoginView(LoginView):
form_class = AuthenticationForm
def dispatch(self, request, *args, **kwargs):
response = super(SSOLoginView, self).dispatch(request, *args, **kwargs)
response = super().dispatch(request, *args, **kwargs)
if request.user.is_authenticated:
translation.set_language(request, response,
request.user.userprofile.language)
@ -65,7 +65,7 @@ class SSOLoginView(LoginView):
# axes_form_invalid when axes >= 5.0.0 becomes available in Debian stable.
@axes_form_invalid
def form_invalid(self, *args, **kwargs):
return super(SSOLoginView, self).form_invalid(*args, **kwargs)
return super().form_invalid(*args, **kwargs)
class CaptchaLoginView(LoginView):
@ -74,8 +74,7 @@ class CaptchaLoginView(LoginView):
form_class = CaptchaAuthenticationForm
def dispatch(self, request, *args, **kwargs):
response = super(CaptchaLoginView,
self).dispatch(request, *args, **kwargs)
response = super().dispatch(request, *args, **kwargs)
if not request.POST:
return response

View File

@ -24,7 +24,7 @@ class TrimmedCharField(forms.CharField):
value = value.strip()
value = value.replace('\r\n', '\n')
return super(TrimmedCharField, self).clean(value)
return super().clean(value)
def bridges_validator(bridges):

View File

@ -17,7 +17,6 @@ class TransmissionForm(DirectorySelectForm):
def __init__(self, *args, **kw):
validator = DirectoryValidator(username=SYSTEM_USER,
check_creatable=True)
super(TransmissionForm,
self).__init__(title=_('Download directory'),
default='/var/lib/transmission-daemon/downloads',
validator=validator, *args, **kw)
super().__init__(title=_('Download directory'),
default='/var/lib/transmission-daemon/downloads',
validator=validator, *args, **kw)

View File

@ -125,7 +125,7 @@ class CreateUserForm(ValidNewUsernameCheckMixin,
def __init__(self, request, *args, **kwargs):
"""Initialize the form with extra request argument."""
self.request = request
super(CreateUserForm, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self.fields['username'].widget.attrs.update({
'autofocus': 'autofocus',
'autocapitalize': 'none',
@ -134,7 +134,7 @@ class CreateUserForm(ValidNewUsernameCheckMixin,
def save(self, commit=True):
"""Save the user model and create LDAP user if required."""
user = super(CreateUserForm, self).save(commit)
user = super().save(commit)
if commit:
user.userprofile.language = self.cleaned_data['language']
@ -206,7 +206,7 @@ class UserUpdateForm(ValidNewUsernameCheckMixin, PasswordConfirmForm,
self.request = request
self.username = username
super(UserUpdateForm, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self.is_last_admin_user = get_last_admin_user() == self.username
self.fields['username'].widget.attrs.update({
'autofocus': 'autofocus',
@ -243,7 +243,7 @@ class UserUpdateForm(ValidNewUsernameCheckMixin, PasswordConfirmForm,
def save(self, commit=True):
"""Update LDAP user name and groups after saving user model."""
user = super(UserUpdateForm, self).save(commit=False)
user = super().save(commit=False)
# Profile is auto saved with user object
user.userprofile.language = self.cleaned_data['language']
auth_username = self.request.user.username
@ -348,13 +348,13 @@ class UserChangePasswordForm(PasswordConfirmForm, SetPasswordForm):
def __init__(self, request, *args, **kwargs):
"""Initialize the form with extra request argument."""
self.request = request
super(UserChangePasswordForm, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self.fields['new_password1'].widget.attrs.update(
{'autofocus': 'autofocus'})
def save(self, commit=True):
"""Save the user model and change LDAP password as well."""
user = super(UserChangePasswordForm, self).save(commit)
user = super().save(commit)
auth_username = self.request.user.username
if commit:
process_input = '{0}\n{1}'.format(

View File

@ -29,7 +29,7 @@ class ContextMixin:
def get_context_data(self, **kwargs):
"""Add self.title to template context."""
context = super(ContextMixin, self).get_context_data(**kwargs)
context = super().get_context_data(**kwargs)
context['title'] = getattr(self, 'title', '')
return context
@ -45,7 +45,7 @@ class UserCreate(ContextMixin, SuccessMessageMixin, CreateView):
def get_form_kwargs(self):
"""Make the request object available to the form."""
kwargs = super(UserCreate, self).get_form_kwargs()
kwargs = super().get_form_kwargs()
kwargs['request'] = self.request
return kwargs
@ -62,7 +62,7 @@ class UserList(AppView, ContextMixin, django.views.generic.ListView):
app_id = 'users'
def get_context_data(self, *args, **kwargs):
context = super(UserList, self).get_context_data(*args, **kwargs)
context = super().get_context_data(*args, **kwargs)
context['last_admin_user'] = get_last_admin_user()
return context
@ -86,14 +86,14 @@ class UserUpdate(ContextMixin, SuccessMessageMixin, UpdateView):
def get_form_kwargs(self):
"""Make the request object available to the form."""
kwargs = super(UserUpdate, self).get_form_kwargs()
kwargs = super().get_form_kwargs()
kwargs['request'] = self.request
kwargs['username'] = self.object.username
return kwargs
def get_initial(self):
"""Return the data for initial form load."""
initial = super(UserUpdate, self).get_initial()
initial = super().get_initial()
try:
ssh_keys = actions.superuser_run(
'ssh', ['get-keys', '--username', self.object.username])
@ -190,7 +190,7 @@ class UserChangePassword(ContextMixin, SuccessMessageMixin, FormView):
def get_form_kwargs(self):
"""Make the user object available to the form."""
kwargs = super(UserChangePassword, self).get_form_kwargs()
kwargs = super().get_form_kwargs()
kwargs['request'] = self.request
kwargs['user'] = User.objects.get(username=self.kwargs['slug'])
return kwargs
@ -209,7 +209,7 @@ class UserChangePassword(ContextMixin, SuccessMessageMixin, FormView):
"""
form.save()
update_session_auth_hash(self.request, form.user)
return super(UserChangePassword, self).form_valid(form)
return super().form_valid(form)
class FirstBootView(django.views.generic.CreateView):
@ -238,7 +238,7 @@ class FirstBootView(django.views.generic.CreateView):
def get_form_kwargs(self):
"""Make request available to the form (to insert messages)"""
kwargs = super(FirstBootView, self).get_form_kwargs()
kwargs = super().get_form_kwargs()
kwargs['request'] = self.request
return kwargs

View File

@ -241,7 +241,7 @@ class PackageException(Exception):
def __init__(self, error_string=None, error_details=None, *args, **kwargs):
"""Store apt-get error string and details."""
super(PackageException, self).__init__(*args, **kwargs)
super().__init__(*args, **kwargs)
self.error_string = error_string
self.error_details = error_details