From f003565074f2349a1341c0a672c94888992635e0 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Tue, 10 Oct 2023 02:31:47 +0000 Subject: [PATCH] [CI] Format code with Black --- src/app.py | 6 ++++-- src/dns.py | 6 +++++- src/tests/test_domains.py | 7 +++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/app.py b/src/app.py index 78c61dfcd..12b3c4233 100644 --- a/src/app.py +++ b/src/app.py @@ -2255,11 +2255,11 @@ def _parse_app_doc_and_notifications(path): def _hydrate_app_template(template, data): - # Apply jinja for stuff like {% if .. %} blocks, # but only if there's indeed an if block (to try to reduce overhead or idk) if "{%" in template: from jinja2 import Template + template = Template(template).render(**data) stuff_to_replace = set(re.findall(r"__[A-Z0-9]+?[A-Z0-9_]*?[A-Z0-9]*?__", template)) @@ -3187,7 +3187,9 @@ def _filter_and_hydrate_notifications(notifications, current_version=None, data= } # Filter out empty notifications (notifications may be empty because of if blocks) - return {name:content for name, content in out.items() if content and content.strip()} + return { + name: content for name, content in out.items() if content and content.strip() + } def _display_notifications(notifications, force=False): diff --git a/src/dns.py b/src/dns.py index fbb461463..1ec88a5c0 100644 --- a/src/dns.py +++ b/src/dns.py @@ -546,7 +546,11 @@ def _get_registrar_config_section(domain): } ) registrar_infos["recovery_password"] = OrderedDict( - {"type": "password", "ask": m18n.n("ask_dyndns_recovery_password"), "default": ""} + { + "type": "password", + "ask": m18n.n("ask_dyndns_recovery_password"), + "default": "", + } ) return OrderedDict(registrar_infos) elif is_special_use_tld(dns_zone): diff --git a/src/tests/test_domains.py b/src/tests/test_domains.py index cc33a87d5..13a9f63b8 100644 --- a/src/tests/test_domains.py +++ b/src/tests/test_domains.py @@ -95,14 +95,17 @@ def test_domain_dyndns_recovery(): domain_add(TEST_DYNDNS_DOMAIN) assert TEST_DYNDNS_DOMAIN in domain_list()["domains"] # set the recovery password with config panel - domain_config_set(TEST_DYNDNS_DOMAIN, "dns.registrar.recovery_password", TEST_DYNDNS_PASSWORD) + domain_config_set( + TEST_DYNDNS_DOMAIN, "dns.registrar.recovery_password", TEST_DYNDNS_PASSWORD + ) # remove domain without unsubscribing domain_remove(TEST_DYNDNS_DOMAIN, ignore_dyndns=True) assert TEST_DYNDNS_DOMAIN not in domain_list()["domains"] # readding domain with bad password should fail with pytest.raises(YunohostValidationError): domain_add( - TEST_DYNDNS_DOMAIN, dyndns_recovery_password="wrong" + TEST_DYNDNS_PASSWORD + TEST_DYNDNS_DOMAIN, + dyndns_recovery_password="wrong" + TEST_DYNDNS_PASSWORD, ) assert TEST_DYNDNS_DOMAIN not in domain_list()["domains"] # readding domain with password should work