mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[CI] Format code with Black
This commit is contained in:
parent
dd6d083904
commit
809c4f4e92
7 changed files with 38 additions and 15 deletions
|
@ -1,6 +1,7 @@
|
|||
import ast
|
||||
|
||||
print("""---
|
||||
print(
|
||||
"""---
|
||||
title: App resources
|
||||
template: docs
|
||||
taxonomy:
|
||||
|
@ -9,7 +10,8 @@ routes:
|
|||
default: '/packaging_apps_resources'
|
||||
---
|
||||
|
||||
""")
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
fname = "../src/utils/resources.py"
|
||||
|
@ -19,12 +21,15 @@ content = open(fname).read()
|
|||
# in which we cant really 'import' the file because it will trigger a bunch of moulinette/yunohost imports...
|
||||
tree = ast.parse(content)
|
||||
|
||||
ResourceClasses = [c for c in tree.body if isinstance(c, ast.ClassDef) and c.bases and c.bases[0].id == 'AppResource']
|
||||
ResourceClasses = [
|
||||
c
|
||||
for c in tree.body
|
||||
if isinstance(c, ast.ClassDef) and c.bases and c.bases[0].id == "AppResource"
|
||||
]
|
||||
|
||||
ResourceDocString = {}
|
||||
|
||||
for c in ResourceClasses:
|
||||
|
||||
assert c.body[1].targets[0].id == "type"
|
||||
resource_id = c.body[1].value.value
|
||||
docstring = ast.get_docstring(c)
|
||||
|
|
10
src/app.py
10
src/app.py
|
@ -2655,9 +2655,7 @@ def _guess_webapp_path_requirement(app_folder: str) -> str:
|
|||
if len(domain_questions) == 1 and len(path_questions) == 1:
|
||||
return "domain_and_path"
|
||||
if len(domain_questions) == 1 and len(path_questions) == 0:
|
||||
|
||||
if manifest.get("packaging_format", 0) < 2:
|
||||
|
||||
# This is likely to be a full-domain app...
|
||||
|
||||
# Confirm that this is a full-domain app This should cover most cases
|
||||
|
@ -2668,7 +2666,9 @@ def _guess_webapp_path_requirement(app_folder: str) -> str:
|
|||
|
||||
# Full-domain apps typically declare something like path_url="/" or path=/
|
||||
# and use ynh_webpath_register or yunohost_app_checkurl inside the install script
|
||||
install_script_content = read_file(os.path.join(app_folder, "scripts/install"))
|
||||
install_script_content = read_file(
|
||||
os.path.join(app_folder, "scripts/install")
|
||||
)
|
||||
|
||||
if re.search(
|
||||
r"\npath(_url)?=[\"']?/[\"']?", install_script_content
|
||||
|
@ -2678,7 +2678,9 @@ def _guess_webapp_path_requirement(app_folder: str) -> str:
|
|||
else:
|
||||
# For packaging v2 apps, check if there's a permission with url being a string
|
||||
perm_resource = manifest.get("resources", {}).get("permissions")
|
||||
if perm_resource is not None and isinstance(perm_resource.get("main", {}).get("url"), str):
|
||||
if perm_resource is not None and isinstance(
|
||||
perm_resource.get("main", {}).get("url"), str
|
||||
):
|
||||
return "full_domain"
|
||||
|
||||
return "?"
|
||||
|
|
|
@ -940,7 +940,14 @@ class RestoreManager:
|
|||
|
||||
# Use a dummy password which is not gonna be saved anywhere
|
||||
# because the next thing to happen should be that a full restore of the LDAP db will happen
|
||||
tools_postinstall(domain, "admin", "Admin", password=random_ascii(70), ignore_dyndns=True, overwrite_root_password=False)
|
||||
tools_postinstall(
|
||||
domain,
|
||||
"admin",
|
||||
"Admin",
|
||||
password=random_ascii(70),
|
||||
ignore_dyndns=True,
|
||||
overwrite_root_password=False,
|
||||
)
|
||||
|
||||
def clean(self):
|
||||
"""
|
||||
|
|
|
@ -593,7 +593,9 @@ def _get_registrar_config_section(domain):
|
|||
registrar_list = read_toml(DOMAIN_REGISTRAR_LIST_PATH)
|
||||
registrar_credentials = registrar_list.get(registrar)
|
||||
if registrar_credentials is None:
|
||||
logger.warning(f"Registrar {registrar} unknown / Should be added to YunoHost's registrar_list.toml by the development team!")
|
||||
logger.warning(
|
||||
f"Registrar {registrar} unknown / Should be added to YunoHost's registrar_list.toml by the development team!"
|
||||
)
|
||||
registrar_credentials = {}
|
||||
for credential, infos in registrar_credentials.items():
|
||||
infos["default"] = infos.get("default", "")
|
||||
|
|
|
@ -53,12 +53,14 @@ class MyMigration(Migration):
|
|||
if not new_admin_user:
|
||||
for user in all_users:
|
||||
aliases = user_info(user).get("mail-aliases", [])
|
||||
if any(alias.startswith(f"admin@{main_domain}") for alias in aliases) \
|
||||
or any(alias.startswith(f"postmaster@{main_domain}") for alias in aliases):
|
||||
if any(
|
||||
alias.startswith(f"admin@{main_domain}") for alias in aliases
|
||||
) or any(
|
||||
alias.startswith(f"postmaster@{main_domain}") for alias in aliases
|
||||
):
|
||||
new_admin_user = user
|
||||
break
|
||||
|
||||
|
||||
self.ldap_migration_started = True
|
||||
|
||||
if new_admin_user:
|
||||
|
|
|
@ -1359,7 +1359,9 @@ class GroupQuestion(Question):
|
|||
|
||||
super().__init__(question, context)
|
||||
|
||||
self.choices = list(user_group_list(short=True, include_primary_groups=False)["groups"])
|
||||
self.choices = list(
|
||||
user_group_list(short=True, include_primary_groups=False)["groups"]
|
||||
)
|
||||
|
||||
def _human_readable_group(g):
|
||||
# i18n: visitors
|
||||
|
|
|
@ -179,7 +179,10 @@ class AppResource:
|
|||
tmpdir = _make_tmp_workdir_for_app(app=self.app)
|
||||
|
||||
env_ = _make_environment_for_app_script(
|
||||
self.app, workdir=tmpdir, action=f"{action}_{self.type}", include_app_settings=True,
|
||||
self.app,
|
||||
workdir=tmpdir,
|
||||
action=f"{action}_{self.type}",
|
||||
include_app_settings=True,
|
||||
)
|
||||
env_.update(env)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue