Merge pull request #1547 from YunoHost/ci-format-dev

[CI] Format code with Black
This commit is contained in:
Alexandre Aubin 2022-12-06 23:52:08 +01:00 committed by GitHub
commit 7e88230cd1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -651,19 +651,23 @@ class ConfigPanel:
raw_msg=True, raw_msg=True,
) )
value = self.values[option["name"]] value = self.values[option["name"]]
# Allow to use value instead of current_value in app config script. # Allow to use value instead of current_value in app config script.
# e.g. apps may write `echo 'value: "foobar"'` in the config file (which is more intuitive that `echo 'current_value: "foobar"'` # e.g. apps may write `echo 'value: "foobar"'` in the config file (which is more intuitive that `echo 'current_value: "foobar"'`
# For example hotspot used it... # For example hotspot used it...
# See https://github.com/YunoHost/yunohost/pull/1546 # See https://github.com/YunoHost/yunohost/pull/1546
if isinstance(value, dict) and "value" in value and "current_value" not in value: if (
isinstance(value, dict)
and "value" in value
and "current_value" not in value
):
value["current_value"] = value["value"] value["current_value"] = value["value"]
# In general, the value is just a simple value. # In general, the value is just a simple value.
# Sometimes it could be a dict used to overwrite the option itself # Sometimes it could be a dict used to overwrite the option itself
value = value if isinstance(value, dict) else {"current_value": value} value = value if isinstance(value, dict) else {"current_value": value}
option.update(value) option.update(value)
self.values[option["id"]] = value.get("current_value") self.values[option["id"]] = value.get("current_value")
return self.values return self.values