From cbb177414ffc510b638f23eb9afb2b613a995849 Mon Sep 17 00:00:00 2001 From: Joseph Nuthalapati Date: Thu, 16 May 2019 17:29:11 +0530 Subject: [PATCH] backups: YAPF formatting Signed-off-by: Joseph Nuthalapati --- plinth/modules/backups/forms.py | 38 +++++++++++++-------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/plinth/modules/backups/forms.py b/plinth/modules/backups/forms.py index 2ac85a281..9a53dd552 100644 --- a/plinth/modules/backups/forms.py +++ b/plinth/modules/backups/forms.py @@ -19,14 +19,16 @@ Forms for backups module. """ import logging + import paramiko from django import forms from django.core.validators import FileExtensionValidator -from django.utils.translation import ugettext, ugettext_lazy as _ +from django.utils.translation import ugettext +from django.utils.translation import ugettext_lazy as _ from plinth.utils import format_lazy -from . import api, network_storage, ROOT_REPOSITORY_NAME +from . import ROOT_REPOSITORY_NAME, api, network_storage from .errors import BorgRepositoryDoesNotExistError from .repository import SshBorgRepository @@ -86,11 +88,10 @@ class RestoreForm(forms.Form): class UploadForm(forms.Form): file = forms.FileField( - label=_('Upload File'), - required=True, - validators=[FileExtensionValidator( - ['gz'], _('Backup files have to be in .tar.gz format'))], - help_text=_('Select the backup file you want to upload')) + label=_('Upload File'), required=True, validators=[ + FileExtensionValidator( + ['gz'], _('Backup files have to be in .tar.gz format')) + ], help_text=_('Select the backup file you want to upload')) class AddRepositoryForm(forms.Form): @@ -102,27 +103,19 @@ class AddRepositoryForm(forms.Form): label=_('SSH server password'), strip=True, help_text=_('Password of the SSH Server.
' 'SSH key-based authentication is not yet possible.'), - widget=forms.PasswordInput(), - required=False) + widget=forms.PasswordInput(), required=False) encryption = forms.ChoiceField( - label=_('Encryption'), - help_text=format_lazy( + label=_('Encryption'), help_text=format_lazy( _('"Key in Repository" means that a ' 'password-protected key is stored with the backup.')), - choices=[('repokey', 'Key in Repository'), ('none', 'None')] - ) + choices=[('repokey', 'Key in Repository'), ('none', 'None')]) encryption_passphrase = forms.CharField( label=_('Passphrase'), help_text=_('Passphrase; Only needed when using encryption.'), - widget=forms.PasswordInput(), - required=False - ) + widget=forms.PasswordInput(), required=False) confirm_encryption_passphrase = forms.CharField( - label=_('Confirm Passphrase'), - help_text=_('Repeat the passphrase.'), - widget=forms.PasswordInput(), - required=False - ) + label=_('Confirm Passphrase'), help_text=_('Repeat the passphrase.'), + widget=forms.PasswordInput(), required=False) def get_credentials(self): credentials = {} @@ -148,8 +141,7 @@ class AddRepositoryForm(forms.Form): if passphrase != confirm_passphrase: raise forms.ValidationError( - _("The entered encryption passphrases do not match") - ) + _("The entered encryption passphrases do not match")) path = cleaned_data.get("repository") credentials = self.get_credentials()