Make the PEP8 happy even though that's unrelated code to the current PR but meh ...

This commit is contained in:
Alexandre Aubin 2019-08-17 19:02:38 +02:00
parent 8dd590e6fc
commit 005ccea610

View file

@ -230,7 +230,8 @@ def app_map(app=None, raw=False, user=None):
app -- Specific app to map app -- Specific app to map
""" """
from yunohost.permission import user_permission_list # TODO / FIXME : Aleks to Josue : not sure why this was included but not used ...
# from yunohost.permission import user_permission_list
from yunohost.utils.ldap import _get_ldap_interface from yunohost.utils.ldap import _get_ldap_interface
apps = [] apps = []
@ -415,9 +416,6 @@ def app_upgrade(app=[], url=None, file=None):
from yunohost.hook import hook_add, hook_remove, hook_exec, hook_callback from yunohost.hook import hook_add, hook_remove, hook_exec, hook_callback
from yunohost.permission import permission_sync_to_user from yunohost.permission import permission_sync_to_user
# Retrieve interface
is_api = msettings.get('interface') == 'api'
try: try:
app_list() app_list()
except YunohostError: except YunohostError:
@ -430,15 +428,15 @@ def app_upgrade(app=[], url=None, file=None):
if not apps: if not apps:
# FIXME : not sure what's supposed to happen if there is a url and a file but no apps... # FIXME : not sure what's supposed to happen if there is a url and a file but no apps...
if not url and not file: if not url and not file:
apps = [app["id"] for app in app_list(installed=True)["apps"]] apps = [app_["id"] for app_ in app_list(installed=True)["apps"]]
elif not isinstance(app, list): elif not isinstance(app, list):
apps = [app] apps = [app]
# Remove possible duplicates # Remove possible duplicates
apps = [app for i,app in enumerate(apps) if apps not in apps[:i]] apps = [app_ for i, app_ in enumerate(apps) if app_ not in apps[:i]]
# Abort if any of those app is in fact not installed.. # Abort if any of those app is in fact not installed..
for app in [app for app in apps if not _is_installed(app)]: for app in [app_ for app_ in apps if not _is_installed(app_)]:
raise YunohostError('app_not_installed', app=app, all_apps=_get_all_installed_apps_id()) raise YunohostError('app_not_installed', app=app, all_apps=_get_all_installed_apps_id())
if len(apps) == 0: if len(apps) == 0:
@ -818,7 +816,7 @@ def app_remove(operation_logger, app):
# TODO: display fail messages from script # TODO: display fail messages from script
try: try:
shutil.rmtree('/tmp/yunohost_remove') shutil.rmtree('/tmp/yunohost_remove')
except: except Exception:
pass pass
# Apply dirty patch to make php5 apps compatible with php7 (e.g. the remove # Apply dirty patch to make php5 apps compatible with php7 (e.g. the remove
@ -919,6 +917,7 @@ def app_clearaccess(operation_logger, apps):
return {'allowed_users': result} return {'allowed_users': result}
def app_debug(app): def app_debug(app):
""" """
Display debug informations for an app Display debug informations for an app
@ -1686,8 +1685,7 @@ def _get_app_config_panel(app_id):
"panel": [], "panel": [],
} }
panels = filter(lambda (key, value): key not in ("name", "version") panels = filter(lambda (key, value): key not in ("name", "version") and isinstance(value, OrderedDict),
and isinstance(value, OrderedDict),
toml_config_panel.items()) toml_config_panel.items())
for key, value in panels: for key, value in panels:
@ -1697,8 +1695,7 @@ def _get_app_config_panel(app_id):
"sections": [], "sections": [],
} }
sections = filter(lambda (k, v): k not in ("name",) sections = filter(lambda (k, v): k not in ("name",) and isinstance(v, OrderedDict),
and isinstance(v, OrderedDict),
value.items()) value.items())
for section_key, section_value in sections: for section_key, section_value in sections:
@ -1708,8 +1705,7 @@ def _get_app_config_panel(app_id):
"options": [], "options": [],
} }
options = filter(lambda (k, v): k not in ("name",) options = filter(lambda (k, v): k not in ("name",) and isinstance(v, OrderedDict),
and isinstance(v, OrderedDict),
section_value.items()) section_value.items())
for option_key, option_value in options: for option_key, option_value in options:
@ -2684,6 +2680,7 @@ def _load_appslist():
# ############################### # # ############################### #
# #
def is_true(arg): def is_true(arg):
""" """
Convert a string into a boolean Convert a string into a boolean