autopep8 --in-place -a -a -a --ignore E402,E501,E722 -r src/yunohost/*.py

This commit is contained in:
Alexandre Aubin 2020-10-30 15:22:40 +01:00
parent 485044335d
commit 05b1a8f96e
4 changed files with 42 additions and 44 deletions

View file

@ -1286,7 +1286,6 @@ def app_setting(app, key, value=None, delete=False):
show_tile=False, show_tile=False,
protected=True) protected=True)
# #
# Regular setting management # Regular setting management
# #
@ -1356,8 +1355,8 @@ def app_ssowatconf():
"show_tile": False, "show_tile": False,
"auth_header": False, "auth_header": False,
"public": True, "public": True,
"uris": \ "uris":
[domain + '/yunohost/admin' for domain in domains] + \ [domain + '/yunohost/admin' for domain in domains] +
[domain + '/yunohost/api' for domain in domains] + [ [domain + '/yunohost/api' for domain in domains] + [
"re:^[^/]*/%.well%-known/ynh%-diagnosis/.*$", "re:^[^/]*/%.well%-known/ynh%-diagnosis/.*$",
"re:^[^/]*/%.well%-known/acme%-challenge/.*$", "re:^[^/]*/%.well%-known/acme%-challenge/.*$",
@ -1365,7 +1364,7 @@ def app_ssowatconf():
] ]
} }
} }
redirected_regex = {main_domain + '/yunohost[\/]?$': 'https://' + main_domain + '/yunohost/sso/'} redirected_regex = {main_domain + r'/yunohost[\/]?$': 'https://' + main_domain + '/yunohost/sso/'}
redirected_urls = {} redirected_urls = {}
for app in _installed_apps(): for app in _installed_apps():
@ -1825,7 +1824,7 @@ def _get_app_config_panel(app_id):
"panel": [], "panel": [],
} }
panels = filter(lambda (key, value): key not in ("name", "version") and isinstance(value, OrderedDict), panels = filter(lambda key_value: key_value[0] not in ("name", "version") and isinstance(key_value[1], OrderedDict),
toml_config_panel.items()) toml_config_panel.items())
for key, value in panels: for key, value in panels:
@ -1835,7 +1834,7 @@ def _get_app_config_panel(app_id):
"sections": [], "sections": [],
} }
sections = filter(lambda (k, v): k not in ("name",) and isinstance(v, OrderedDict), sections = filter(lambda k_v1: k_v1[0] not in ("name",) and isinstance(k_v1[1], OrderedDict),
value.items()) value.items())
for section_key, section_value in sections: for section_key, section_value in sections:
@ -1845,7 +1844,7 @@ def _get_app_config_panel(app_id):
"options": [], "options": [],
} }
options = filter(lambda (k, v): k not in ("name",) and isinstance(v, OrderedDict), options = filter(lambda k_v: k_v[0] not in ("name",) and isinstance(k_v[1], OrderedDict),
section_value.items()) section_value.items())
for option_key, option_value in options: for option_key, option_value in options:
@ -3160,4 +3159,4 @@ def _patch_legacy_helpers(app_folder):
if show_warning: if show_warning:
# And complain about those damn deprecated helpers # And complain about those damn deprecated helpers
logger.error("/!\ Packagers ! This app uses a very old deprecated helpers ... Yunohost automatically patched the helpers to use the new recommended practice, but please do consider fixing the upstream code right now ...") logger.error(r"/!\ Packagers ! This app uses a very old deprecated helpers ... Yunohost automatically patched the helpers to use the new recommended practice, but please do consider fixing the upstream code right now ...")

View file

@ -882,7 +882,6 @@ class RestoreManager():
logger.debug("executing the post-install...") logger.debug("executing the post-install...")
tools_postinstall(domain, 'Yunohost', True) tools_postinstall(domain, 'Yunohost', True)
def clean(self): def clean(self):
""" """
End a restore operations by cleaning the working directory and End a restore operations by cleaning the working directory and
@ -1200,7 +1199,7 @@ class RestoreManager():
# do the migration 0011 : setup group and permission # do the migration 0011 : setup group and permission
# #
# Legacy code # Legacy code
if not "all_users" in user_group_list()["groups"].keys(): if "all_users" not in user_group_list()["groups"].keys():
from yunohost.utils.legacy import SetupGroupPermissions from yunohost.utils.legacy import SetupGroupPermissions
# Update LDAP schema restart slapd # Update LDAP schema restart slapd
logger.info(m18n.n("migration_0011_update_LDAP_schema")) logger.info(m18n.n("migration_0011_update_LDAP_schema"))
@ -1225,7 +1224,6 @@ class RestoreManager():
permission_sync_to_user() permission_sync_to_user()
def _restore_apps(self): def _restore_apps(self):
"""Restore all apps targeted""" """Restore all apps targeted"""
@ -2176,6 +2174,7 @@ def backup_list(with_info=False, human_readable=False):
archives = set([os.path.realpath(archive) for archive in archives]) archives = set([os.path.realpath(archive) for archive in archives])
archives = sorted(archives, key=lambda x: os.path.getctime(x)) archives = sorted(archives, key=lambda x: os.path.getctime(x))
# Extract only filename without the extension # Extract only filename without the extension
def remove_extension(f): def remove_extension(f):
if f.endswith(".tar.gz"): if f.endswith(".tar.gz"):
return os.path.basename(f)[:-len(".tar.gz")] return os.path.basename(f)[:-len(".tar.gz")]

View file

@ -140,7 +140,7 @@ def user_permission_update(operation_logger, permission, add=None, remove=None,
raise YunohostError('permission_require_account', permission=permission) raise YunohostError('permission_require_account', permission=permission)
# Refuse to add "visitors" to protected permission # Refuse to add "visitors" to protected permission
if ((add and "visitors" in add and existing_permission["protected"]) or \ if ((add and "visitors" in add and existing_permission["protected"]) or
(remove and "visitors" in remove and existing_permission["protected"])) and not force: (remove and "visitors" in remove and existing_permission["protected"])) and not force:
raise YunohostError('permission_protected', permission=permission) raise YunohostError('permission_protected', permission=permission)