Merge pull request #1935 from YunoHost/actions/black

Format Python code with Black
This commit is contained in:
Alexandre Aubin 2024-08-27 13:12:40 +02:00 committed by GitHub
commit 518c3bbbe2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2007,7 +2007,6 @@ ynh_app_config_run $1
app_script_env.update(env) app_script_env.update(env)
env = app_script_env env = app_script_env
ret, values = hook_exec(config_script, args=[action], env=env) ret, values = hook_exec(config_script, args=[action], env=env)
if ret != 0: if ret != 0:
if action == "show": if action == "show":
@ -2037,9 +2036,9 @@ ynh_app_config_run $1
for panel, section, option in self._iterate(): for panel, section, option in self._iterate():
bind_panel = panel.get('bind') bind_panel = panel.get("bind")
bind_section = section.get('bind') bind_section = section.get("bind")
if not bind_section: if not bind_section:
bind_section = bind_panel bind_section = bind_panel
elif bind_section[-1] == ":" and bind_panel and ":" in bind_panel: elif bind_section[-1] == ":" and bind_panel and ":" in bind_panel:
@ -2049,28 +2048,30 @@ ynh_app_config_run $1
else: else:
bind_section = selector + bind_section + bind_panel_file bind_section = selector + bind_section + bind_panel_file
bind = option.get('bind') bind = option.get("bind")
if not bind: if not bind:
if bind_section: if bind_section:
bind = bind_section bind = bind_section
else: else:
bind = 'settings' bind = "settings"
elif bind[-1] == ":" and bind_section and ":" in bind_section: elif bind[-1] == ":" and bind_section and ":" in bind_section:
selector, bind_file = bind_section.split(":") selector, bind_file = bind_section.split(":")
if ">" in bind: if ">" in bind:
bind = bind + bind_file bind = bind + bind_file
else: else:
bind = selector + bind + bind_file bind = selector + bind + bind_file
if bind == "settings" and option.get('type', 'string') == 'file': if bind == "settings" and option.get("type", "string") == "file":
bind = 'null' bind = "null"
option["bind"] = _hydrate_app_template(bind, settings) option["bind"] = _hydrate_app_template(bind, settings)
def _dump_options_types_and_binds(self): def _dump_options_types_and_binds(self):
lines = [] lines = []
for _, _, option in self._iterate(): for _, _, option in self._iterate():
lines.append('|'.join([option['id'], option.get('type', 'string'), option["bind"]])) lines.append(
return '\n'.join(lines) "|".join([option["id"], option.get("type", "string"), option["bind"]])
)
return "\n".join(lines)
app_settings_cache: Dict[str, Dict[str, Any]] = {} app_settings_cache: Dict[str, Dict[str, Any]] = {}