From 85b501c9eb99a73f6f84289a43368c453d49ebfa Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 17 Oct 2022 21:39:14 +0000 Subject: [PATCH] [CI] Format code with Black --- src/diagnosers/00-basesystem.py | 14 ++++++++++++-- src/tools.py | 11 ++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/diagnosers/00-basesystem.py b/src/diagnosers/00-basesystem.py index aeb9956a5..20b5cde6a 100644 --- a/src/diagnosers/00-basesystem.py +++ b/src/diagnosers/00-basesystem.py @@ -138,7 +138,12 @@ class MyDiagnoser(Diagnoser): ) # Using yunohost testing channel - if os.system("grep -q '^\\s*deb\\s*.*yunohost.org.*\\stesting' /etc/apt/sources.list /etc/apt/sources.list.d/*") == 0: + if ( + os.system( + "grep -q '^\\s*deb\\s*.*yunohost.org.*\\stesting' /etc/apt/sources.list /etc/apt/sources.list.d/*" + ) + == 0 + ): yield dict( meta={"test": "apt_yunohost_channel"}, status="WARNING", @@ -150,7 +155,12 @@ class MyDiagnoser(Diagnoser): # will cause the machine to spontaenously upgrade everything as soon as next debian is released ... # Note that we grep this from the policy for libc6, because it's hard to know exactly which apt repo # is configured (it may not be simply debian.org) - if os.system("apt policy libc6 2>/dev/null | grep '^\\s*500' | awk '{print $3}' | tr '/' ' ' | awk '{print $1}' | grep -q 'stable'") == 0: + if ( + os.system( + "apt policy libc6 2>/dev/null | grep '^\\s*500' | awk '{print $3}' | tr '/' ' ' | awk '{print $1}' | grep -q 'stable'" + ) + == 0 + ): yield dict( meta={"test": "apt_debian_codename"}, status="WARNING", diff --git a/src/tools.py b/src/tools.py index 8ff89a1dd..7fc061c00 100644 --- a/src/tools.py +++ b/src/tools.py @@ -402,11 +402,13 @@ def tools_update(target=None): logger.info(m18n.n("already_up_to_date")) important_yunohost_upgrade = False - if upgradable_system_packages and any(p["name"] == "yunohost" for p in upgradable_system_packages): + if upgradable_system_packages and any( + p["name"] == "yunohost" for p in upgradable_system_packages + ): yunohost = [p for p in upgradable_system_packages if p["name"] == "yunohost"][0] current_version = yunohost["current_version"].split(".")[:2] new_version = yunohost["new_version"].split(".")[:2] - important_yunohost_upgrade = (current_version != new_version) + important_yunohost_upgrade = current_version != new_version # Wrapping this in a try/except just in case for some reason we can't load # the migrations, which would result in the update/upgrade process being blocked... @@ -521,7 +523,10 @@ def tools_upgrade(operation_logger, target=None): returncode = call_async_output(dist_upgrade, callbacks, shell=True) # If yunohost is being upgraded from the webadmin - if any(p["name"] == "yunohost" for p in upgradables) and Moulinette.interface.type == "api": + if ( + any(p["name"] == "yunohost" for p in upgradables) + and Moulinette.interface.type == "api" + ): # Restart the API after 10 sec (at now doesn't support sub-minute times...) # We do this so that the API / webadmin still gets the proper HTTP response