From 14040b8fd2ee18e93e051202a8dd3ee3cc9b8fe2 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 10 Jul 2023 17:05:52 +0000 Subject: [PATCH] [CI] Format code with Black --- src/app.py | 9 ++++++--- src/diagnosers/12-dnsrecords.py | 2 +- src/tests/test_apps.py | 4 +++- src/tests/test_appurl.py | 10 +++++++--- src/utils/resources.py | 22 +++++++++++++--------- 5 files changed, 30 insertions(+), 17 deletions(-) diff --git a/src/app.py b/src/app.py index cce0aa51c..a77cf51b8 100644 --- a/src/app.py +++ b/src/app.py @@ -2784,9 +2784,12 @@ def _check_manifest_requirements( # Some apps have a higher runtime value than build ... if ram_requirement["build"] != "?" and ram_requirement["runtime"] != "?": - max_build_runtime = (ram_requirement["build"] - if human_to_binary(ram_requirement["build"]) > human_to_binary(ram_requirement["runtime"]) - else ram_requirement["runtime"]) + max_build_runtime = ( + ram_requirement["build"] + if human_to_binary(ram_requirement["build"]) + > human_to_binary(ram_requirement["runtime"]) + else ram_requirement["runtime"] + ) else: max_build_runtime = ram_requirement["build"] diff --git a/src/diagnosers/12-dnsrecords.py b/src/diagnosers/12-dnsrecords.py index be9bf5418..196a2e1f9 100644 --- a/src/diagnosers/12-dnsrecords.py +++ b/src/diagnosers/12-dnsrecords.py @@ -182,7 +182,7 @@ class MyDiagnoser(Diagnoser): if success != "ok": return None else: - if type_ == "TXT" and isinstance(answers,list): + if type_ == "TXT" and isinstance(answers, list): for part in answers: if part.startswith('"v=spf1'): return part diff --git a/src/tests/test_apps.py b/src/tests/test_apps.py index e6e1342ba..d7a591a36 100644 --- a/src/tests/test_apps.py +++ b/src/tests/test_apps.py @@ -339,7 +339,9 @@ def test_app_from_catalog(): assert app_map_[main_domain]["/site"]["id"] == "my_webapp" assert app_is_installed(main_domain, "my_webapp") - assert app_is_exposed_on_http(main_domain, "/site", "you have just installed My Webapp") + assert app_is_exposed_on_http( + main_domain, "/site", "you have just installed My Webapp" + ) # Try upgrade, should do nothing app_upgrade("my_webapp") diff --git a/src/tests/test_appurl.py b/src/tests/test_appurl.py index 996a5a2c3..d0c55f732 100644 --- a/src/tests/test_appurl.py +++ b/src/tests/test_appurl.py @@ -71,10 +71,14 @@ def test_repo_url_definition(): ### Gitea assert _is_app_repo_url("https://gitea.instance.tld/user/repo_ynh") - assert _is_app_repo_url("https://gitea.instance.tld/user/repo_ynh/src/branch/branch_name") + assert _is_app_repo_url( + "https://gitea.instance.tld/user/repo_ynh/src/branch/branch_name" + ) assert _is_app_repo_url("https://gitea.instance.tld/user/repo_ynh/src/tag/tag_name") - assert _is_app_repo_url("https://gitea.instance.tld/user/repo_ynh/src/commit/abcd1234") - + assert _is_app_repo_url( + "https://gitea.instance.tld/user/repo_ynh/src/commit/abcd1234" + ) + ### Invalid patterns # no schema diff --git a/src/utils/resources.py b/src/utils/resources.py index 7f6f263de..8d33c3bac 100644 --- a/src/utils/resources.py +++ b/src/utils/resources.py @@ -1065,9 +1065,11 @@ class AptDependenciesAppResource(AppResource): if isinstance(values.get("packages"), str): values["packages"] = [value.strip() for value in values["packages"].split(",")] # type: ignore - if not isinstance(values.get("repo"), str) \ - or not isinstance(values.get("key"), str) \ - or not isinstance(values.get("packages"), list): + if ( + not isinstance(values.get("repo"), str) + or not isinstance(values.get("key"), str) + or not isinstance(values.get("packages"), list) + ): raise YunohostError( "In apt resource in the manifest: 'extras' repo should have the keys 'repo', 'key' defined as strings and 'packages' defined as list", raw_msg=True, @@ -1076,12 +1078,14 @@ class AptDependenciesAppResource(AppResource): def provision_or_update(self, context: Dict = {}): script = " ".join(["ynh_install_app_dependencies", *self.packages]) for repo, values in self.extras.items(): - script += "\n" + " ".join([ - "ynh_install_extra_app_dependencies", - f"--repo='{values['repo']}'", - f"--key='{values['key']}'", - f"--package='{' '.join(values['packages'])}'" - ]) + script += "\n" + " ".join( + [ + "ynh_install_extra_app_dependencies", + f"--repo='{values['repo']}'", + f"--key='{values['key']}'", + f"--package='{' '.join(values['packages'])}'", + ] + ) # FIXME : we're feeding the raw value of values['packages'] to the helper .. if we want to be consistent, may they should be comma-separated, though in the majority of cases, only a single package is installed from an extra repo.. self._run_script("provision_or_update", script)