mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-11-29 08:25:10 +00:00
fix formatting issues
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
1 parent
fa74a26042
commit
eb83e00011
134 files changed
+598
-720
No files matched your search
@@ -108,9 +108,8 @@ def _backup_handler(packet, encryption_passphrase=None):
|
||||
arguments = ['create-archive', '--path', packet.path, '--paths'] + paths
|
||||
input_data = ''
|
||||
if encryption_passphrase:
|
||||
input_data = json.dumps({
|
||||
'encryption_passphrase': encryption_passphrase
|
||||
})
|
||||
input_data = json.dumps(
|
||||
{'encryption_passphrase': encryption_passphrase})
|
||||
|
||||
actions.superuser_run('backups', arguments, input=input_data.encode())
|
||||
|
||||
|
||||
@@ -82,7 +82,6 @@ def _validate_service(service):
|
||||
|
||||
class BackupError:
|
||||
"""Represent an backup/restore operation error."""
|
||||
|
||||
def __init__(self, error_type, app, hook=None):
|
||||
"""Initialize the error object."""
|
||||
self.error_type = error_type
|
||||
@@ -98,7 +97,6 @@ class BackupError:
|
||||
|
||||
class Packet:
|
||||
"""Information passed to a handlers for backup/restore operations."""
|
||||
|
||||
def __init__(self, operation, scope, root, apps=None, path=None):
|
||||
"""Initialize the packet.
|
||||
|
||||
@@ -240,7 +238,6 @@ def _install_apps_before_restore(apps):
|
||||
|
||||
class BackupApp:
|
||||
"""A application that can be backed up and its manifest."""
|
||||
|
||||
def __init__(self, name, app):
|
||||
"""Initialize object and load manfiest."""
|
||||
self.name = name
|
||||
@@ -365,7 +362,6 @@ def _switch_to_subvolume(subvolume):
|
||||
|
||||
class ServiceHandler:
|
||||
"""Abstraction to help with service shutdown/restart."""
|
||||
|
||||
@staticmethod
|
||||
def create(backup_app, service):
|
||||
service_type = 'system'
|
||||
@@ -400,7 +396,6 @@ class ServiceHandler:
|
||||
|
||||
class SystemServiceHandler(ServiceHandler):
|
||||
"""Handle starting and stopping of system services for backup."""
|
||||
|
||||
def __init__(self, backup_app, service):
|
||||
"""Initialize the object."""
|
||||
super().__init__(backup_app, service)
|
||||
@@ -420,7 +415,6 @@ class SystemServiceHandler(ServiceHandler):
|
||||
|
||||
class ApacheServiceHandler(ServiceHandler):
|
||||
"""Handle starting and stopping of Apache services for backup."""
|
||||
|
||||
def __init__(self, backup_app, service):
|
||||
"""Initialize the object."""
|
||||
super().__init__(backup_app, service)
|
||||
|
||||
@@ -30,7 +30,6 @@ def delete_tmp_backup_file(function):
|
||||
XXX: Implement a better way to delete uploaded files.
|
||||
|
||||
"""
|
||||
|
||||
@functools.wraps(function)
|
||||
def wrapper(request, *args, **kwargs):
|
||||
path = request.session.get(SESSION_PATH_VARIABLE, None)
|
||||
|
||||
@@ -59,10 +59,8 @@ KNOWN_ERRORS = [
|
||||
'errors': [
|
||||
'not a valid repository', 'does not exist', 'FileNotFoundError'
|
||||
],
|
||||
'message':
|
||||
_('Repository not found'),
|
||||
'raise_as':
|
||||
errors.BorgRepositoryDoesNotExistError,
|
||||
'message': _('Repository not found'),
|
||||
'raise_as': errors.BorgRepositoryDoesNotExistError,
|
||||
},
|
||||
{
|
||||
'errors': ['passphrase supplied in .* is incorrect'],
|
||||
@@ -176,7 +174,6 @@ class BaseBorgRepository(abc.ABC):
|
||||
|
||||
def remove(self):
|
||||
"""Remove a borg repository"""
|
||||
|
||||
def list_archives(self):
|
||||
"""Return list of archives in this repository."""
|
||||
output = self.run(['list-repo', '--path', self.borg_path])
|
||||
@@ -241,7 +238,6 @@ class BaseBorgRepository(abc.ABC):
|
||||
|
||||
def get_download_stream(self, archive_name):
|
||||
"""Return an stream of .tar.gz binary data for a backup archive."""
|
||||
|
||||
class BufferedReader(io.BufferedReader):
|
||||
"""Improve performance of buffered binary streaming.
|
||||
|
||||
@@ -255,7 +251,6 @@ class BaseBorgRepository(abc.ABC):
|
||||
binary data.
|
||||
|
||||
"""
|
||||
|
||||
def __next__(self):
|
||||
"""Override to call read() instead of readline()."""
|
||||
chunk = self.read(io.DEFAULT_BUFFER_SIZE)
|
||||
|
||||
@@ -57,7 +57,6 @@ def _get_backup_app(name):
|
||||
|
||||
class TestBackupApp:
|
||||
"""Test the BackupApp class."""
|
||||
|
||||
@staticmethod
|
||||
def test_run_hook():
|
||||
"""Test running a hook on an application."""
|
||||
@@ -82,7 +81,6 @@ class TestBackupApp:
|
||||
@pytest.mark.usefixtures('load_cfg')
|
||||
class TestBackupProcesses:
|
||||
"""Test cases for backup processes"""
|
||||
|
||||
@staticmethod
|
||||
def test_packet_process_manifests():
|
||||
"""Test that directories/files are collected from manifests."""
|
||||
@@ -239,7 +237,6 @@ class TestBackupProcesses:
|
||||
|
||||
class TestBackupModule:
|
||||
"""Tests of the backups django module, like views or forms."""
|
||||
|
||||
@staticmethod
|
||||
def test_file_upload():
|
||||
# posting a video should fail
|
||||
|
||||
Reference in new issue
Block a user