mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2025-01-23 09:16:51 +00:00
style: remove unused imports
This commit is contained in:
parent
d621ca6449
commit
d6cf2abdc2
|
@ -9,8 +9,7 @@ from typing import List, TypeVar, Callable
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
from json.decoder import JSONDecodeError
|
from json.decoder import JSONDecodeError
|
||||||
from os.path import exists, join
|
from os.path import exists, join
|
||||||
from os import listdir, mkdir
|
from os import mkdir
|
||||||
from time import sleep
|
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
|
|
||||||
from selfprivacy_api.backup.util import output_yielder, sync
|
from selfprivacy_api.backup.util import output_yielder, sync
|
||||||
|
@ -33,12 +32,12 @@ def unlocked_repo(func: T) -> T:
|
||||||
def inner(self: ResticBackupper, *args, **kwargs):
|
def inner(self: ResticBackupper, *args, **kwargs):
|
||||||
try:
|
try:
|
||||||
return func(self, *args, **kwargs)
|
return func(self, *args, **kwargs)
|
||||||
except Exception as e:
|
except Exception as error:
|
||||||
if "unable to create lock" in str(e):
|
if "unable to create lock" in str(error):
|
||||||
self.unlock()
|
self.unlock()
|
||||||
return func(self, *args, **kwargs)
|
return func(self, *args, **kwargs)
|
||||||
else:
|
else:
|
||||||
raise e
|
raise error
|
||||||
|
|
||||||
# Above, we manually guarantee that the type returned is compatible.
|
# Above, we manually guarantee that the type returned is compatible.
|
||||||
return inner # type: ignore
|
return inner # type: ignore
|
||||||
|
@ -293,8 +292,8 @@ class ResticBackupper(AbstractBackupper):
|
||||||
break
|
break
|
||||||
if "unable" in line:
|
if "unable" in line:
|
||||||
raise ValueError(line)
|
raise ValueError(line)
|
||||||
except Exception as e:
|
except Exception as error:
|
||||||
raise ValueError("could not lock repository") from e
|
raise ValueError("could not lock repository") from error
|
||||||
|
|
||||||
@unlocked_repo
|
@unlocked_repo
|
||||||
def restored_size(self, snapshot_id: str) -> int:
|
def restored_size(self, snapshot_id: str) -> int:
|
||||||
|
|
Loading…
Reference in a new issue