Merge pull request #1633 from YunoHost/ci-format-debian/11.1.16

[CI] Format code with Black
This commit is contained in:
Alexandre Aubin 2023-04-04 12:27:01 +02:00 committed by GitHub
commit d5469b77c5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 8 deletions

View file

@ -581,7 +581,9 @@ class ConfigPanel:
logger.warning(f"Unknown key '{key}' found in config panel") logger.warning(f"Unknown key '{key}' found in config panel")
# Todo search all i18n keys # Todo search all i18n keys
out[key] = ( out[key] = (
value if key not in ["ask", "help", "name"] or isinstance(value, dict) else {"en": value} value
if key not in ["ask", "help", "name"] or isinstance(value, dict)
else {"en": value}
) )
return out return out

View file

@ -520,21 +520,36 @@ class PermissionsResource(AppResource):
properties["main"] = self.default_perm_properties properties["main"] = self.default_perm_properties
for perm, infos in properties.items(): for perm, infos in properties.items():
if "auth_header" in infos and not isinstance(infos.get("auth_header"), bool): if "auth_header" in infos and not isinstance(
raise YunohostError(f"In manifest, for permission '{perm}', 'auth_header' should be a boolean", raw_msg=True) infos.get("auth_header"), bool
):
raise YunohostError(
f"In manifest, for permission '{perm}', 'auth_header' should be a boolean",
raw_msg=True,
)
if "show_tile" in infos and not isinstance(infos.get("show_tile"), bool): if "show_tile" in infos and not isinstance(infos.get("show_tile"), bool):
raise YunohostError(f"In manifest, for permission '{perm}', 'show_tile' should be a boolean", raw_msg=True) raise YunohostError(
f"In manifest, for permission '{perm}', 'show_tile' should be a boolean",
raw_msg=True,
)
if "protected" in infos and not isinstance(infos.get("protected"), bool): if "protected" in infos and not isinstance(infos.get("protected"), bool):
raise YunohostError(f"In manifest, for permission '{perm}', 'protected' should be a boolean", raw_msg=True) raise YunohostError(
if "additional_urls" in infos and not isinstance(infos.get("additional_urls"), list): f"In manifest, for permission '{perm}', 'protected' should be a boolean",
raise YunohostError(f"In manifest, for permission '{perm}', 'additional_urls' should be a list", raw_msg=True) raw_msg=True,
)
if "additional_urls" in infos and not isinstance(
infos.get("additional_urls"), list
):
raise YunohostError(
f"In manifest, for permission '{perm}', 'additional_urls' should be a list",
raw_msg=True,
)
properties[perm] = copy.copy(self.default_perm_properties) properties[perm] = copy.copy(self.default_perm_properties)
properties[perm].update(infos) properties[perm].update(infos)
if properties[perm]["show_tile"] is None: if properties[perm]["show_tile"] is None:
properties[perm]["show_tile"] = bool(properties[perm]["url"]) properties[perm]["show_tile"] = bool(properties[perm]["url"])
if properties["main"]["url"] is not None and ( if properties["main"]["url"] is not None and (
not isinstance(properties["main"].get("url"), str) not isinstance(properties["main"].get("url"), str)
or properties["main"]["url"] != "/" or properties["main"]["url"] != "/"