style: fix styling

pull/35/head
Inex Code 2023-06-29 13:44:29 +03:00
parent cd2e9d3ba3
commit b480c84041
2 changed files with 8 additions and 14 deletions

View File

@ -37,7 +37,7 @@ DEFAULT_JSON_PROVIDER = {
class Backups: class Backups:
"""A stateless controller class for backups""" """A stateless controller class for backups"""
### Providers ### Providers
@staticmethod @staticmethod
def provider(): def provider():
@ -70,7 +70,6 @@ class Backups:
# if there is no userdata file, we do not need to reset it # if there is no userdata file, we do not need to reset it
pass pass
@staticmethod @staticmethod
def _lookup_provider() -> AbstractBackupProvider: def _lookup_provider() -> AbstractBackupProvider:
redis_provider = Backups._load_provider_redis() redis_provider = Backups._load_provider_redis()
@ -160,7 +159,7 @@ class Backups:
user_data["backup"] = DEFAULT_JSON_PROVIDER user_data["backup"] = DEFAULT_JSON_PROVIDER
### Init ### Init
@staticmethod @staticmethod
def init_repo(): def init_repo():
@ -179,7 +178,7 @@ class Backups:
return False return False
### Backup ### Backup
@staticmethod @staticmethod
def back_up(service: Service): def back_up(service: Service):
@ -207,8 +206,7 @@ class Backups:
Jobs.update(job, status=JobStatus.FINISHED) Jobs.update(job, status=JobStatus.FINISHED)
return snapshot return snapshot
### Restoring ### Restoring
@staticmethod @staticmethod
def restore_snapshot(snapshot: Snapshot): def restore_snapshot(snapshot: Snapshot):
@ -271,7 +269,7 @@ class Backups:
folders, folders,
) )
### Snapshots ### Snapshots
@staticmethod @staticmethod
def get_snapshots(service: Service) -> List[Snapshot]: def get_snapshots(service: Service) -> List[Snapshot]:
@ -328,9 +326,8 @@ class Backups:
# expiring cache entry # expiring cache entry
Storage.cache_snapshot(snapshot) Storage.cache_snapshot(snapshot)
### Autobackup
### Autobackup
@staticmethod @staticmethod
def is_autobackup_enabled(service: Service) -> bool: def is_autobackup_enabled(service: Service) -> bool:
return Storage.is_autobackup_set(service.get_id()) return Storage.is_autobackup_set(service.get_id())
@ -424,7 +421,7 @@ class Backups:
) )
] ]
### Helpers ### Helpers
@staticmethod @staticmethod
def space_usable_for_service(service: Service) -> int: def space_usable_for_service(service: Service) -> int:
@ -446,6 +443,3 @@ class Backups:
repo_id="", repo_id="",
) )
Storage.store_provider(provider) Storage.store_provider(provider)

View File

@ -315,7 +315,7 @@ def test_backup_larger_file(backups, dummy_service):
assert_job_has_run(job_type_id) assert_job_has_run(job_type_id)
updates = job_progress_updates(job_type_id) updates = job_progress_updates(job_type_id)
assert len(updates) > 3 assert len(updates) > 3
assert updates[int((len(updates)-1)/2.0)] > 10 assert updates[int((len(updates) - 1) / 2.0)] > 10
def test_restore_snapshot_task(backups, dummy_service): def test_restore_snapshot_task(backups, dummy_service):