From c409888a4bbf74b32c651955b7443193c6746304 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 26 Aug 2024 20:14:48 +0200 Subject: [PATCH] quality: use _assert_is_installed for consistency instead of if not _is_intalled(app): raise --- src/app.py | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) diff --git a/src/app.py b/src/app.py index 538800dda..b9d64138d 100644 --- a/src/app.py +++ b/src/app.py @@ -328,10 +328,7 @@ def app_map(app=None, raw=False, user=None): result = {} if app is not None: - if not _is_installed(app): - raise YunohostValidationError( - "app_not_installed", app=app, all_apps=_get_all_installed_apps_id() - ) + _assert_is_installed(app) apps = [ app, ] @@ -1424,10 +1421,7 @@ def app_remove(operation_logger, app, purge=False, force_workdir=None): ) from yunohost.domain import domain_list, domain_config_get, domain_config_set - if not _is_installed(app): - raise YunohostValidationError( - "app_not_installed", app=app, all_apps=_get_all_installed_apps_id() - ) + _assert_is_installed(app) operation_logger.start() @@ -2728,16 +2722,6 @@ def _list_upgradable_apps(): def _is_installed(app: str) -> bool: - """ - Check if application is installed - - Keyword arguments: - app -- id of App to check - - Returns: - Boolean - - """ return os.path.isdir(APPS_SETTING_PATH + app)