From dfb4ad3260755df8501beb618267cc1b103fea7a Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Wed, 13 Jun 2018 17:47:11 +0530 Subject: [PATCH] yapf and isort fixes Signed-off-by: Sunil Mohan Adapa --- plinth/modules/cockpit/__init__.py | 41 +++++++++++++---------------- plinth/modules/ejabberd/__init__.py | 27 ++++++++++--------- plinth/modules/ikiwiki/__init__.py | 4 +-- plinth/modules/jsxc/manifest.py | 3 +-- plinth/modules/ttrss/__init__.py | 2 +- 5 files changed, 37 insertions(+), 40 deletions(-) diff --git a/plinth/modules/cockpit/__init__.py b/plinth/modules/cockpit/__init__.py index 6c3e1f206..2d48f6a5d 100644 --- a/plinth/modules/cockpit/__init__.py +++ b/plinth/modules/cockpit/__init__.py @@ -20,16 +20,13 @@ FreedomBox app to configure Cockpit. from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ -from plinth.utils import format_lazy -from plinth import actions -from plinth import action_utils -from plinth import cfg -from plinth import frontpage +from plinth import action_utils, actions, cfg, frontpage from plinth import service as service_module from plinth.menu import main_menu from plinth.modules import names from plinth.signals import domain_added, domain_removed, domainname_change +from plinth.utils import format_lazy version = 1 @@ -53,8 +50,8 @@ description = [ '/_cockpit/ path on the web server. It can be accessed by ' 'any user with a {box_name} login. ' 'Sensitive information and system altering abilities are limited to ' - 'users belonging to admin group.'), - box_name=_(cfg.box_name), users_url=reverse_lazy('users:index')), + 'users belonging to admin group.'), box_name=_(cfg.box_name), + users_url=reverse_lazy('users:index')), _('Currently only limited functionality is available.'), ] @@ -70,10 +67,10 @@ def init(): global service setup_helper = globals()['setup_helper'] if setup_helper.get_state() != 'needs-setup': - service = service_module.Service( - managed_services[0], name, ports=['http', 'https'], - is_external=True, - is_enabled=is_enabled, enable=enable, disable=disable) + service = service_module.Service(managed_services[0], name, ports=[ + 'http', 'https' + ], is_external=True, is_enabled=is_enabled, enable=enable, + disable=disable) if is_enabled(): add_shortcut() @@ -86,16 +83,17 @@ def init(): def setup(helper, old_version=None): """Install and configure the module.""" helper.install(managed_packages) - domains = [domain - for domains_of_a_type in names.domains.values() - for domain in domains_of_a_type] + domains = [ + domain for domains_of_a_type in names.domains.values() + for domain in domains_of_a_type + ] helper.call('post', actions.superuser_run, 'cockpit', ['setup'] + domains) global service if service is None: - service = service_module.Service( - managed_services[0], name, ports=['http', 'https'], - is_external=True, - is_enabled=is_enabled, enable=enable, disable=disable) + service = service_module.Service(managed_services[0], name, ports=[ + 'http', 'https' + ], is_external=True, is_enabled=is_enabled, enable=enable, + disable=disable) helper.call('post', service.notify_enabled, None, True) helper.call('post', add_shortcut) @@ -104,14 +102,13 @@ def add_shortcut(): """Add a shortcut the frontpage.""" frontpage.add_shortcut('cockpit', name, short_description=short_description, - url='/_cockpit/', - login_required=True) + url='/_cockpit/', login_required=True) def is_enabled(): """Return whether the module is enabled.""" - return (action_utils.webserver_is_enabled('cockpit-freedombox') and - action_utils.service_is_running('cockpit.socket')) + return (action_utils.webserver_is_enabled('cockpit-freedombox') + and action_utils.service_is_running('cockpit.socket')) def enable(): diff --git a/plinth/modules/ejabberd/__init__.py b/plinth/modules/ejabberd/__init__.py index 148533b5b..1490fad55 100644 --- a/plinth/modules/ejabberd/__init__.py +++ b/plinth/modules/ejabberd/__init__.py @@ -24,8 +24,8 @@ import socket from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ -from plinth import service as service_module from plinth import action_utils, actions, cfg, frontpage +from plinth import service as service_module from plinth.menu import main_menu from plinth.signals import (domainname_change, post_hostname_change, pre_hostname_change) @@ -51,10 +51,9 @@ description = [ 'web client or any other XMPP client. ' 'When enabled, ejabberd can be accessed by any ' - 'user with a {box_name} login.'), - box_name=_(cfg.box_name), users_url=reverse_lazy('users:index'), - jsxc_url=reverse_lazy('jsxc:index') - ) + 'user with a {box_name} login.'), box_name=_(cfg.box_name), + users_url=reverse_lazy('users:index'), + jsxc_url=reverse_lazy('jsxc:index')) ] clients = clients @@ -77,10 +76,11 @@ def init(): global service setup_helper = globals()['setup_helper'] if setup_helper.get_state() != 'needs-setup': - service = service_module.Service('ejabberd', name, ports=[ - 'xmpp-client', 'xmpp-server', 'xmpp-bosh' - ], is_external=True, is_enabled=is_enabled, enable=enable, - disable=disable) + service = service_module.Service( + 'ejabberd', name, + ports=['xmpp-client', 'xmpp-server', + 'xmpp-bosh'], is_external=True, is_enabled=is_enabled, + enable=enable, disable=disable) if is_enabled(): add_shortcut() pre_hostname_change.connect(on_pre_hostname_change) @@ -99,10 +99,11 @@ def setup(helper, old_version=None): helper.call('post', actions.superuser_run, 'ejabberd', ['setup']) global service if service is None: - service = service_module.Service('ejabberd', name, ports=[ - 'xmpp-client', 'xmpp-server', 'xmpp-bosh' - ], is_external=True, is_enabled=is_enabled, enable=enable, - disable=disable) + service = service_module.Service( + 'ejabberd', name, + ports=['xmpp-client', 'xmpp-server', + 'xmpp-bosh'], is_external=True, is_enabled=is_enabled, + enable=enable, disable=disable) helper.call('post', service.notify_enabled, None, True) helper.call('post', add_shortcut) diff --git a/plinth/modules/ikiwiki/__init__.py b/plinth/modules/ikiwiki/__init__.py index a416973c1..dc055fbfa 100644 --- a/plinth/modules/ikiwiki/__init__.py +++ b/plinth/modules/ikiwiki/__init__.py @@ -21,8 +21,8 @@ FreedomBox app to configure ikiwiki. from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ -from plinth import service as service_module from plinth import action_utils, actions, cfg, frontpage +from plinth import service as service_module from plinth.menu import main_menu from plinth.modules.users import register_group from plinth.utils import format_lazy @@ -54,7 +54,7 @@ description = [ 'group can edit existing ones. In the ' 'User Configuration you can change these ' 'permissions or add new users.'), box_name=_(cfg.box_name), - users_url = reverse_lazy('users:index')) + users_url=reverse_lazy('users:index')) ] clients = clients diff --git a/plinth/modules/jsxc/manifest.py b/plinth/modules/jsxc/manifest.py index 152edfed0..ec3606132 100644 --- a/plinth/modules/jsxc/manifest.py +++ b/plinth/modules/jsxc/manifest.py @@ -21,8 +21,7 @@ from django.utils.translation import ugettext_lazy as _ from plinth.clients import validate clients = validate([{ - 'name': - _('JSXC'), + 'name': _('JSXC'), 'platforms': [{ 'type': 'web', 'url': reverse_lazy('jsxc:jsxc') diff --git a/plinth/modules/ttrss/__init__.py b/plinth/modules/ttrss/__init__.py index 52167a0c9..09d1436df 100644 --- a/plinth/modules/ttrss/__init__.py +++ b/plinth/modules/ttrss/__init__.py @@ -21,8 +21,8 @@ FreedomBox app to configure Tiny Tiny RSS. from django.urls import reverse_lazy from django.utils.translation import ugettext_lazy as _ -from plinth import service as service_module from plinth import action_utils, actions, cfg, frontpage +from plinth import service as service_module from plinth.menu import main_menu from plinth.modules.users import register_group from plinth.utils import format_lazy