Reformat files with black

This commit is contained in:
deajan 2025-01-22 20:04:06 +01:00
parent b5bebbf198
commit df8434df10
2 changed files with 15 additions and 9 deletions

View file

@ -859,7 +859,9 @@ class ResticRunner:
result, output = self.executor(cmd, method="monitor")
if result:
if build_type in ["gui", "viewer"]:
msg = f"Successfully listed snapshot {snapshot} content (not showed here)"
msg = (
f"Successfully listed snapshot {snapshot} content (not showed here)"
)
else:
msg = f"Successfully listed snapshot {snapshot} content:\n{output}"
else:

View file

@ -65,13 +65,12 @@ def get_current_username(credentials: HTTPBasicCredentials = Depends(security)):
for user in config_dict["http_server"]["users"]:
try:
if secrets.compare_digest(
credentials.username.encode("utf-8"), user.get("username").encode("utf-8")
credentials.username.encode("utf-8"),
user.get("username").encode("utf-8"),
):
if secrets.compare_digest(
credentials.password.encode("utf-8"),
user.get("password").encode(
"utf-8"
),
user.get("password").encode("utf-8"),
):
authenticated_user = user
break
@ -101,7 +100,6 @@ def get_user_permissions(username: str):
return []
@app.get("/")
async def api_root(auth=Depends(get_current_username)):
if crud.is_enabled():
@ -165,7 +163,9 @@ async def current_version(
try:
has_permission = (
True if audience.value in get_user_permissions(auth).get("audience") else False
True
if audience.value in get_user_permissions(auth).get("audience")
else False
)
except Exception as exc:
logger.error(f"Failed to get user permissions (1): {exc}")
@ -265,7 +265,9 @@ async def upgrades(
try:
has_permission = (
True if audience.value in get_user_permissions(auth).get("audience") else False
True
if audience.value in get_user_permissions(auth).get("audience")
else False
)
except Exception as exc:
logger.error(f"Failed to get user permissions (2): {exc}")
@ -367,7 +369,9 @@ async def download(
try:
has_permission = (
True if audience.value in get_user_permissions(auth).get("audience") else False
True
if audience.value in get_user_permissions(auth).get("audience")
else False
)
except Exception as exc:
logger.error(f"Failed to get user permissions (3): {exc}")