From 5439084c84b9cd593cedd2a9913a865db2ee8998 Mon Sep 17 00:00:00 2001 From: Nikolas Nyby Date: Wed, 24 Jul 2019 23:59:37 -0400 Subject: [PATCH] Add flake8 to gitlib-ci - closes #58 And fix the rest of the flake8 errors. Reviewed-by: Sunil Mohan Adapa --- .gitlab-ci.yml | 1 + plinth/axes_app_config.py | 3 +-- plinth/modules/apache/components.py | 4 ++-- plinth/modules/avahi/__init__.py | 2 +- plinth/modules/bind/__init__.py | 2 +- plinth/modules/cockpit/__init__.py | 2 +- plinth/modules/config/__init__.py | 4 +++- plinth/modules/config/forms.py | 24 ++++++++++--------- plinth/modules/coquelicot/__init__.py | 2 +- plinth/modules/datetime/__init__.py | 2 +- plinth/modules/deluge/__init__.py | 2 +- plinth/modules/diagnostics/__init__.py | 2 +- plinth/modules/diaspora/__init__.py | 2 +- plinth/modules/dynamicdns/__init__.py | 2 +- plinth/modules/ejabberd/__init__.py | 2 +- plinth/modules/ejabberd/views.py | 2 +- plinth/modules/firewall/__init__.py | 2 +- plinth/modules/i2p/__init__.py | 2 +- plinth/modules/i2p/helpers.py | 7 ++++-- plinth/modules/i2p/views.py | 4 ++-- plinth/modules/ikiwiki/__init__.py | 2 +- plinth/modules/infinoted/__init__.py | 2 +- plinth/modules/jsxc/__init__.py | 2 +- plinth/modules/letsencrypt/__init__.py | 2 +- .../letsencrypt/tests/test_components.py | 20 ++++++++++++---- plinth/modules/letsencrypt/views.py | 1 - plinth/modules/matrixsynapse/__init__.py | 2 +- plinth/modules/mediawiki/__init__.py | 2 +- plinth/modules/minetest/__init__.py | 2 +- plinth/modules/mldonkey/__init__.py | 2 +- plinth/modules/monkeysphere/__init__.py | 2 +- plinth/modules/mumble/__init__.py | 2 +- plinth/modules/names/__init__.py | 2 +- plinth/modules/openvpn/__init__.py | 2 +- plinth/modules/pagekite/__init__.py | 2 +- .../modules/pagekite/tests/test_pagekite.py | 1 + plinth/modules/power/__init__.py | 2 +- plinth/modules/privoxy/__init__.py | 2 +- plinth/modules/quassel/__init__.py | 2 +- plinth/modules/radicale/__init__.py | 2 +- plinth/modules/radicale/manifest.py | 3 ++- plinth/modules/repro/__init__.py | 2 +- plinth/modules/roundcube/__init__.py | 2 +- plinth/modules/searx/__init__.py | 2 +- plinth/modules/security/__init__.py | 2 +- plinth/modules/security/forms.py | 6 ++--- plinth/modules/shadowsocks/__init__.py | 2 +- plinth/modules/sharing/__init__.py | 2 +- plinth/modules/sharing/forms.py | 4 ++-- plinth/modules/snapshot/__init__.py | 2 +- plinth/modules/snapshot/urls.py | 3 ++- plinth/modules/snapshot/views.py | 3 ++- plinth/modules/ssh/__init__.py | 2 +- plinth/modules/sso/forms.py | 4 +++- plinth/modules/storage/__init__.py | 2 +- plinth/modules/syncthing/__init__.py | 2 +- plinth/modules/tahoe/__init__.py | 2 +- plinth/modules/tor/__init__.py | 2 +- plinth/modules/transmission/__init__.py | 2 +- plinth/modules/ttrss/__init__.py | 2 +- plinth/modules/upgrades/__init__.py | 2 +- plinth/modules/users/views.py | 3 ++- plinth/tests/config.py | 2 +- 63 files changed, 105 insertions(+), 82 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9a61aab16..672299f3d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -21,6 +21,7 @@ run-unit-tests: - echo "tester:password" | chpasswd - cp -r . /home/tester/plinth - chown -R tester:tester /home/tester/plinth + - su -c "cd ~/plinth; python3 -m flake8 plinth" tester - su -c "cd ~/plinth; py.test-3 --cov=plinth --cov-report=html --cov-report=term" tester - cp -r /home/tester/plinth/htmlcov test-coverage-report diff --git a/plinth/axes_app_config.py b/plinth/axes_app_config.py index 2d8a2b553..32696d680 100644 --- a/plinth/axes_app_config.py +++ b/plinth/axes_app_config.py @@ -26,5 +26,4 @@ class AppConfig(apps.AppConfig): def ready(self): # Signals must be loaded for axes to get the login_failed signals - # flake8: noqa - from axes import signals # isort:skip pylint: disable=unused-import + from axes import signals # noqa pylint: disable=unused-import isort:skip diff --git a/plinth/modules/apache/components.py b/plinth/modules/apache/components.py index f64864640..4dd654c9b 100644 --- a/plinth/modules/apache/components.py +++ b/plinth/modules/apache/components.py @@ -69,8 +69,8 @@ class Uwsgi(app.LeaderComponent): component_id should be a unique ID across all components of an app and across all components. - uwsgi_name is the primary part of the configuration file path which must - be enabled/disabled by this component. + uwsgi_name is the primary part of the configuration file path + which must be enabled/disabled by this component. """ super().__init__(component_id) diff --git a/plinth/modules/avahi/__init__.py b/plinth/modules/avahi/__init__.py index cc430dfac..c963fd834 100644 --- a/plinth/modules/avahi/__init__.py +++ b/plinth/modules/avahi/__init__.py @@ -28,7 +28,7 @@ from plinth.modules.firewall.components import Firewall from plinth.utils import format_lazy from plinth.views import AppView -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import # pylint: disable=C0103 diff --git a/plinth/modules/bind/__init__.py b/plinth/modules/bind/__init__.py index d0a3d680d..b8a9112a2 100644 --- a/plinth/modules/bind/__init__.py +++ b/plinth/modules/bind/__init__.py @@ -29,7 +29,7 @@ from plinth.daemon import Daemon from plinth.modules.firewall.components import Firewall from plinth.utils import format_lazy -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/cockpit/__init__.py b/plinth/modules/cockpit/__init__.py index 6ddfb1873..21ddea77c 100644 --- a/plinth/modules/cockpit/__init__.py +++ b/plinth/modules/cockpit/__init__.py @@ -31,7 +31,7 @@ from plinth.modules.firewall.components import Firewall from plinth.signals import domain_added, domain_removed, domainname_change from plinth.utils import format_lazy -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/config/__init__.py b/plinth/modules/config/__init__.py index c99741289..12aaaadbe 100644 --- a/plinth/modules/config/__init__.py +++ b/plinth/modules/config/__init__.py @@ -113,7 +113,9 @@ def get_home_page(): def change_home_page(shortcut_id): - """Change the FreedomBox's default redirect to URL of the shortcut specified.""" + """Change the FreedomBox's default redirect to URL of the shortcut + specified. + """ if shortcut_id == 'plinth': url = '/plinth/' elif shortcut_id == 'apache-default': diff --git a/plinth/modules/config/forms.py b/plinth/modules/config/forms.py index 762dd91fa..ea11ddb94 100644 --- a/plinth/modules/config/forms.py +++ b/plinth/modules/config/forms.py @@ -62,11 +62,12 @@ class ConfigurationForm(forms.Form): hostname = forms.CharField( label=ugettext_lazy('Hostname'), help_text=format_lazy( ugettext_lazy( - 'Hostname is the local name by which other devices on the local ' - 'network can reach your {box_name}. It must start and end with ' - 'an alphabet or a digit and have as interior characters only ' - 'alphabets, digits and hyphens. Total length must be 63 ' - 'characters or less.'), box_name=ugettext_lazy(cfg.box_name)), + 'Hostname is the local name by which other devices on the ' + 'local network can reach your {box_name}. It must start and ' + 'end with an alphabet or a digit and have as interior ' + 'characters only alphabets, digits and hyphens. Total ' + 'length must be 63 characters or less.'), + box_name=ugettext_lazy(cfg.box_name)), validators=[ validators.RegexValidator(HOSTNAME_REGEX, ugettext_lazy('Invalid hostname')) @@ -76,12 +77,13 @@ class ConfigurationForm(forms.Form): label=ugettext_lazy('Domain Name'), help_text=format_lazy( ugettext_lazy( 'Domain name is the global name by which other devices on the ' - 'Internet can reach your {box_name}. It must consist of labels ' - 'separated by dots. Each label must start and end with an ' - 'alphabet or a digit and have as interior characters only ' - 'alphabets, digits and hyphens. Length of each label must be 63 ' - 'characters or less. Total length of domain name must be 253 ' - 'characters or less.'), box_name=ugettext_lazy(cfg.box_name)), + 'Internet can reach your {box_name}. It must consist of ' + 'labels separated by dots. Each label must start and end ' + 'with an alphabet or a digit and have as interior characters ' + 'only alphabets, digits and hyphens. Length of each label ' + 'must be 63 characters or less. Total length of domain name ' + 'must be 253 characters or less.'), + box_name=ugettext_lazy(cfg.box_name)), required=False, validators=[ validators.RegexValidator( r'^[a-zA-Z0-9]([-a-zA-Z0-9.]{,251}[a-zA-Z0-9])?$', diff --git a/plinth/modules/coquelicot/__init__.py b/plinth/modules/coquelicot/__init__.py index 0afa64071..1ad4a05af 100644 --- a/plinth/modules/coquelicot/__init__.py +++ b/plinth/modules/coquelicot/__init__.py @@ -27,7 +27,7 @@ from plinth.daemon import Daemon from plinth.modules.apache.components import Webserver from plinth.modules.firewall.components import Firewall -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import clients = clients diff --git a/plinth/modules/datetime/__init__.py b/plinth/modules/datetime/__init__.py index 8da4f834c..40f2a4a4f 100644 --- a/plinth/modules/datetime/__init__.py +++ b/plinth/modules/datetime/__init__.py @@ -26,7 +26,7 @@ from plinth import app as app_module from plinth import menu from plinth.daemon import Daemon -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 2 diff --git a/plinth/modules/deluge/__init__.py b/plinth/modules/deluge/__init__.py index 708bf12d9..ad0cc049b 100644 --- a/plinth/modules/deluge/__init__.py +++ b/plinth/modules/deluge/__init__.py @@ -28,7 +28,7 @@ from plinth.modules.apache.components import Webserver from plinth.modules.firewall.components import Firewall from plinth.modules.users import register_group -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 2 diff --git a/plinth/modules/diagnostics/__init__.py b/plinth/modules/diagnostics/__init__.py index 81f2b8a3e..e6b9cdc39 100644 --- a/plinth/modules/diagnostics/__init__.py +++ b/plinth/modules/diagnostics/__init__.py @@ -24,7 +24,7 @@ from plinth import action_utils from plinth import app as app_module from plinth import menu -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/diaspora/__init__.py b/plinth/modules/diaspora/__init__.py index f8854399e..0575154c6 100644 --- a/plinth/modules/diaspora/__init__.py +++ b/plinth/modules/diaspora/__init__.py @@ -70,7 +70,7 @@ description = [ ' federate with other diaspora* pods.') ] -from .manifest import clients # isort:skip +from .manifest import clients # noqa pylint:disable=E402 isort:skip clients = clients app = None diff --git a/plinth/modules/dynamicdns/__init__.py b/plinth/modules/dynamicdns/__init__.py index 92baee282..fb35a5cd5 100644 --- a/plinth/modules/dynamicdns/__init__.py +++ b/plinth/modules/dynamicdns/__init__.py @@ -28,7 +28,7 @@ from plinth.modules.names import SERVICES from plinth.signals import domain_added from plinth.utils import format_lazy -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/ejabberd/__init__.py b/plinth/modules/ejabberd/__init__.py index 1ac860288..0085a8f10 100644 --- a/plinth/modules/ejabberd/__init__.py +++ b/plinth/modules/ejabberd/__init__.py @@ -36,7 +36,7 @@ from plinth.signals import (domainname_change, post_hostname_change, pre_hostname_change) from plinth.utils import format_lazy -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 3 diff --git a/plinth/modules/ejabberd/views.py b/plinth/modules/ejabberd/views.py index 6e438fb87..3d7dc67e8 100644 --- a/plinth/modules/ejabberd/views.py +++ b/plinth/modules/ejabberd/views.py @@ -22,7 +22,7 @@ from django.contrib import messages from django.utils.translation import ugettext as _ from plinth import actions -from plinth.modules import config, ejabberd +from plinth.modules import ejabberd from plinth.views import AppView from .forms import EjabberdForm diff --git a/plinth/modules/firewall/__init__.py b/plinth/modules/firewall/__init__.py index a66d14ac3..b93694bf1 100644 --- a/plinth/modules/firewall/__init__.py +++ b/plinth/modules/firewall/__init__.py @@ -25,7 +25,7 @@ from plinth import app as app_module from plinth import cfg, menu from plinth.utils import Version, format_lazy -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 2 diff --git a/plinth/modules/i2p/__init__.py b/plinth/modules/i2p/__init__.py index 9ceb5ec9a..02806b2b6 100644 --- a/plinth/modules/i2p/__init__.py +++ b/plinth/modules/i2p/__init__.py @@ -29,7 +29,7 @@ from plinth.modules.firewall.components import Firewall from plinth.modules.i2p.resources import FAVORITES from plinth.modules.users import register_group -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/i2p/helpers.py b/plinth/modules/i2p/helpers.py index 6374fc9f2..c74138c2d 100644 --- a/plinth/modules/i2p/helpers.py +++ b/plinth/modules/i2p/helpers.py @@ -96,8 +96,11 @@ class TunnelEditor(): :rtype: basestring """ - calced_prop_path = '/files{filepath}/tunnel.{idx}.{tunnel_prop}'.format( - idx=self.idx, tunnel_prop=tunnel_prop, filepath=self.conf_filename) + calced_prop_path = \ + '/files{filepath}/tunnel.{idx}.{tunnel_prop}'.format( + idx=self.idx, + tunnel_prop=tunnel_prop, + filepath=self.conf_filename) return calced_prop_path def set_tunnel_prop(self, tunnel_prop, value): diff --git a/plinth/modules/i2p/views.py b/plinth/modules/i2p/views.py index 68ec2d517..0ad916e1e 100644 --- a/plinth/modules/i2p/views.py +++ b/plinth/modules/i2p/views.py @@ -104,6 +104,6 @@ class TorrentsView(ServiceBaseView): service_path = '/i2p/i2psnark/' service_description = [ _('I2P provides an application to download files anonymously in a ' - 'peer-to-peer network. Download files by adding torrents or create a ' - 'new torrent to share a file.'), + 'peer-to-peer network. Download files by adding torrents or ' + 'create a new torrent to share a file.'), ] diff --git a/plinth/modules/ikiwiki/__init__.py b/plinth/modules/ikiwiki/__init__.py index 18c25c815..657b39e99 100644 --- a/plinth/modules/ikiwiki/__init__.py +++ b/plinth/modules/ikiwiki/__init__.py @@ -29,7 +29,7 @@ from plinth.modules.firewall.components import Firewall from plinth.modules.users import register_group from plinth.utils import format_lazy -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/infinoted/__init__.py b/plinth/modules/infinoted/__init__.py index 329c961af..491a294c1 100644 --- a/plinth/modules/infinoted/__init__.py +++ b/plinth/modules/infinoted/__init__.py @@ -29,7 +29,7 @@ from plinth.modules.firewall.components import Firewall from plinth.utils import format_lazy from plinth.views import AppView -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/jsxc/__init__.py b/plinth/modules/jsxc/__init__.py index cd1036e7b..1f855c594 100644 --- a/plinth/modules/jsxc/__init__.py +++ b/plinth/modules/jsxc/__init__.py @@ -27,7 +27,7 @@ from plinth import app as app_module from plinth import frontpage, menu from plinth.modules.firewall.components import Firewall -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/letsencrypt/__init__.py b/plinth/modules/letsencrypt/__init__.py index 47db694da..6443c3d34 100644 --- a/plinth/modules/letsencrypt/__init__.py +++ b/plinth/modules/letsencrypt/__init__.py @@ -34,7 +34,7 @@ from plinth.signals import (domain_added, domain_removed, domainname_change, from plinth.utils import format_lazy from . import components -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 3 diff --git a/plinth/modules/letsencrypt/tests/test_components.py b/plinth/modules/letsencrypt/tests/test_components.py index 0491d9903..fc206a8c2 100644 --- a/plinth/modules/letsencrypt/tests/test_components.py +++ b/plinth/modules/letsencrypt/tests/test_components.py @@ -275,7 +275,9 @@ def test_on_certificate_obtained(superuser_run, component): def test_on_certificate_obtained_with_all_domains(superuser_run, component): - """Test that certificate obtained event handler works for app with all domains.""" + """Test that certificate obtained event handler works for app with + all domains. + """ component._domains = '*' component.on_certificate_obtained(['valid.example'], '/etc/letsencrypt/live/valid.example/') @@ -286,7 +288,9 @@ def test_on_certificate_obtained_with_all_domains(superuser_run, component): def test_on_certificate_obtained_irrelevant(superuser_run, component): - """Test that certificate obtained event handler works with irrelevant domain.""" + """Test that certificate obtained event handler works with + irrelevant domain. + """ component.on_certificate_obtained( ['irrelevant.example'], '/etc/letsencrypt/live/irrelevant.example/') _assert_copy_certificate_called(component, superuser_run, {}) @@ -313,7 +317,9 @@ def test_on_certificate_renewed(superuser_run, component): def test_on_certificate_renewed_irrelevant(superuser_run, component): - """Test that certificate renewed event handler works for irrelevant domains.""" + """Test that certificate renewed event handler works for + irrelevant domains. +""" component.on_certificate_renewed( ['irrelevant.example'], '/etc/letsencrypt/live/irrelevant.example/') _assert_copy_certificate_called(component, superuser_run, {}) @@ -340,7 +346,9 @@ def test_on_certificate_revoked(superuser_run, component): def test_on_certificate_revoked_irrelevant(superuser_run, component): - """Test that certificate revoked event handler works for irrelevant domains.""" + """Test that certificate revoked event handler works for + irrelevant domains. + """ component.on_certificate_revoked( ['irrelevant.example'], '/etc/letsencrypt/live/irrelevant.example/') _assert_copy_certificate_called(component, superuser_run, {}) @@ -367,7 +375,9 @@ def test_on_certificate_deleted(superuser_run, component): def test_on_certificate_deleted_irrelevant(superuser_run, component): - """Test that certificate deleted event handler works for irrelevant domains.""" + """Test that certificate deleted event handler works for + irrelevant domains. + """ component.on_certificate_deleted( ['irrelevant.example'], '/etc/letsencrypt/live/irrelevant.example/') _assert_copy_certificate_called(component, superuser_run, {}) diff --git a/plinth/modules/letsencrypt/views.py b/plinth/modules/letsencrypt/views.py index ed7abea31..86553cc9d 100644 --- a/plinth/modules/letsencrypt/views.py +++ b/plinth/modules/letsencrypt/views.py @@ -27,7 +27,6 @@ from django.urls import reverse_lazy from django.utils.translation import ugettext as _ from django.views.decorators.http import require_POST -from plinth import actions from plinth.errors import ActionError from plinth.modules import letsencrypt diff --git a/plinth/modules/matrixsynapse/__init__.py b/plinth/modules/matrixsynapse/__init__.py index a13c9f9a0..864ce9b11 100644 --- a/plinth/modules/matrixsynapse/__init__.py +++ b/plinth/modules/matrixsynapse/__init__.py @@ -34,7 +34,7 @@ from plinth.modules.apache.components import Webserver from plinth.modules.firewall.components import Firewall from plinth.modules.letsencrypt.components import LetsEncrypt -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 5 diff --git a/plinth/modules/mediawiki/__init__.py b/plinth/modules/mediawiki/__init__.py index 0589c0206..a369d7561 100644 --- a/plinth/modules/mediawiki/__init__.py +++ b/plinth/modules/mediawiki/__init__.py @@ -27,7 +27,7 @@ from plinth.daemon import Daemon from plinth.modules.apache.components import Webserver from plinth.modules.firewall.components import Firewall -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 6 diff --git a/plinth/modules/minetest/__init__.py b/plinth/modules/minetest/__init__.py index 1252ce3df..94669df3b 100644 --- a/plinth/modules/minetest/__init__.py +++ b/plinth/modules/minetest/__init__.py @@ -29,7 +29,7 @@ from plinth.daemon import Daemon from plinth.modules.firewall.components import Firewall from plinth.utils import format_lazy -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 2 diff --git a/plinth/modules/mldonkey/__init__.py b/plinth/modules/mldonkey/__init__.py index 99b82be0f..cc00f050e 100644 --- a/plinth/modules/mldonkey/__init__.py +++ b/plinth/modules/mldonkey/__init__.py @@ -29,7 +29,7 @@ from plinth.modules.firewall.components import Firewall from plinth.modules.users import register_group from plinth.utils import format_lazy -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/monkeysphere/__init__.py b/plinth/modules/monkeysphere/__init__.py index 2b1b8796a..f9187dac7 100644 --- a/plinth/modules/monkeysphere/__init__.py +++ b/plinth/modules/monkeysphere/__init__.py @@ -23,7 +23,7 @@ from django.utils.translation import ugettext_lazy as _ from plinth import app as app_module from plinth import menu -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/mumble/__init__.py b/plinth/modules/mumble/__init__.py index 0e060a1ae..60ee04a8f 100644 --- a/plinth/modules/mumble/__init__.py +++ b/plinth/modules/mumble/__init__.py @@ -28,7 +28,7 @@ from plinth.daemon import Daemon from plinth.modules.firewall.components import Firewall from plinth.views import AppView -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/names/__init__.py b/plinth/modules/names/__init__.py index b9a30cf1c..340b611b1 100644 --- a/plinth/modules/names/__init__.py +++ b/plinth/modules/names/__init__.py @@ -27,7 +27,7 @@ from plinth import cfg, menu from plinth.signals import domain_added, domain_removed from plinth.utils import format_lazy -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import SERVICES = ( ('http', _('HTTP'), 80), diff --git a/plinth/modules/openvpn/__init__.py b/plinth/modules/openvpn/__init__.py index 97e11217e..5c782f38b 100644 --- a/plinth/modules/openvpn/__init__.py +++ b/plinth/modules/openvpn/__init__.py @@ -28,7 +28,7 @@ from plinth.daemon import Daemon from plinth.modules.firewall.components import Firewall from plinth.utils import format_lazy -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 3 diff --git a/plinth/modules/pagekite/__init__.py b/plinth/modules/pagekite/__init__.py index 0cd61e53e..92808f2ac 100644 --- a/plinth/modules/pagekite/__init__.py +++ b/plinth/modules/pagekite/__init__.py @@ -25,7 +25,7 @@ from plinth import cfg, menu from plinth.utils import format_lazy from . import utils -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/pagekite/tests/test_pagekite.py b/plinth/modules/pagekite/tests/test_pagekite.py index 8375c3e86..46d0c387d 100644 --- a/plinth/modules/pagekite/tests/test_pagekite.py +++ b/plinth/modules/pagekite/tests/test_pagekite.py @@ -47,6 +47,7 @@ _tests = [ }, ] + def test_convert_service_to_string(): """ Test deconstructing parameter dictionaries into strings """ for test in _tests: diff --git a/plinth/modules/power/__init__.py b/plinth/modules/power/__init__.py index 064d17ae6..a5bef71dc 100644 --- a/plinth/modules/power/__init__.py +++ b/plinth/modules/power/__init__.py @@ -20,7 +20,7 @@ FreedomBox app for power controls. from django.utils.translation import ugettext_lazy as _ -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/privoxy/__init__.py b/plinth/modules/privoxy/__init__.py index 8b4876b02..5d7ce8f00 100644 --- a/plinth/modules/privoxy/__init__.py +++ b/plinth/modules/privoxy/__init__.py @@ -29,7 +29,7 @@ from plinth.modules.firewall.components import Firewall from plinth.utils import format_lazy from plinth.views import AppView -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/quassel/__init__.py b/plinth/modules/quassel/__init__.py index 782ceb196..5ee3823dc 100644 --- a/plinth/modules/quassel/__init__.py +++ b/plinth/modules/quassel/__init__.py @@ -29,7 +29,7 @@ from plinth.modules.firewall.components import Firewall from plinth.utils import format_lazy from plinth.views import AppView -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/radicale/__init__.py b/plinth/modules/radicale/__init__.py index 52807e79c..d9dae49bb 100644 --- a/plinth/modules/radicale/__init__.py +++ b/plinth/modules/radicale/__init__.py @@ -34,7 +34,7 @@ from plinth.modules.apache.components import Uwsgi, Webserver from plinth.modules.firewall.components import Firewall from plinth.utils import format_lazy -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 2 diff --git a/plinth/modules/radicale/manifest.py b/plinth/modules/radicale/manifest.py index 1cf982ee5..883caebb4 100644 --- a/plinth/modules/radicale/manifest.py +++ b/plinth/modules/radicale/manifest.py @@ -77,7 +77,8 @@ clients = validate([{ 'usage': _('In Evolution add a new calendar and address book ' 'respectively with WebDAV. Enter the URL of the Radicale ' - 'server (e.g. https://) and your user name. ' + 'server (e.g. https://) and your ' + 'user name. ' 'Clicking on the search button will list the existing ' 'calendars and address books.'), 'platforms': [{ diff --git a/plinth/modules/repro/__init__.py b/plinth/modules/repro/__init__.py index 1ba7b4477..804c03fa9 100644 --- a/plinth/modules/repro/__init__.py +++ b/plinth/modules/repro/__init__.py @@ -29,7 +29,7 @@ from plinth.modules.apache.components import Webserver from plinth.modules.firewall.components import Firewall from plinth.views import AppView -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 2 diff --git a/plinth/modules/roundcube/__init__.py b/plinth/modules/roundcube/__init__.py index d95c8559d..89fe2936b 100644 --- a/plinth/modules/roundcube/__init__.py +++ b/plinth/modules/roundcube/__init__.py @@ -26,7 +26,7 @@ from plinth import frontpage, menu from plinth.modules.apache.components import Webserver from plinth.modules.firewall.components import Firewall -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/searx/__init__.py b/plinth/modules/searx/__init__.py index e6efa8e80..1b1b3012d 100644 --- a/plinth/modules/searx/__init__.py +++ b/plinth/modules/searx/__init__.py @@ -29,7 +29,7 @@ from plinth.modules.apache.components import Uwsgi, Webserver from plinth.modules.firewall.components import Firewall from plinth.modules.users import register_group -from .manifest import PUBLIC_ACCESS_SETTING_FILE, backup, clients +from .manifest import PUBLIC_ACCESS_SETTING_FILE, backup, clients # noqa, pylint: disable=unused-import clients = clients diff --git a/plinth/modules/security/__init__.py b/plinth/modules/security/__init__.py index bc7815804..5f8f763cb 100644 --- a/plinth/modules/security/__init__.py +++ b/plinth/modules/security/__init__.py @@ -24,7 +24,7 @@ from plinth import actions from plinth import app as app_module from plinth import menu -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 6 diff --git a/plinth/modules/security/forms.py b/plinth/modules/security/forms.py index 04c278f70..a5f791f4a 100644 --- a/plinth/modules/security/forms.py +++ b/plinth/modules/security/forms.py @@ -33,6 +33,6 @@ class SecurityForm(forms.Form): 'without further authorization.')) fail2ban_enabled = forms.BooleanField( label=_('Fail2Ban (recommended)'), required=False, - help_text=_('When this option is enabled, Fail2Ban will limit brute force ' - 'break-in attempts to the SSH server and other enabled ' - 'password protected internet-services.')) + help_text=_('When this option is enabled, Fail2Ban will limit ' + 'brute force break-in attempts to the SSH server and ' + 'other enabled password protected internet-services.')) diff --git a/plinth/modules/shadowsocks/__init__.py b/plinth/modules/shadowsocks/__init__.py index 971a00d1b..1a185fa86 100644 --- a/plinth/modules/shadowsocks/__init__.py +++ b/plinth/modules/shadowsocks/__init__.py @@ -28,7 +28,7 @@ from plinth.daemon import Daemon from plinth.modules.firewall.components import Firewall from plinth.utils import format_lazy -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/sharing/__init__.py b/plinth/modules/sharing/__init__.py index a6de7ac6a..778960769 100644 --- a/plinth/modules/sharing/__init__.py +++ b/plinth/modules/sharing/__init__.py @@ -27,7 +27,7 @@ from plinth import app as app_module from plinth import cfg, menu from plinth.utils import format_lazy -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/sharing/forms.py b/plinth/modules/sharing/forms.py index e788218fe..a93de4d09 100644 --- a/plinth/modules/sharing/forms.py +++ b/plinth/modules/sharing/forms.py @@ -75,5 +75,5 @@ class AddShareForm(forms.Form): groups = self.cleaned_data.get('groups') if not is_public and not groups: raise forms.ValidationError( - _('Shares should be either public or shared with at least one group' - )) + _('Shares should be either public or shared with at ' + 'least one group')) diff --git a/plinth/modules/snapshot/__init__.py b/plinth/modules/snapshot/__init__.py index 2c1c81e0b..87f7b5a73 100644 --- a/plinth/modules/snapshot/__init__.py +++ b/plinth/modules/snapshot/__init__.py @@ -28,7 +28,7 @@ from plinth import app as app_module from plinth import menu from plinth.modules import storage -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 4 diff --git a/plinth/modules/snapshot/urls.py b/plinth/modules/snapshot/urls.py index f3b3aa324..284146d9c 100644 --- a/plinth/modules/snapshot/urls.py +++ b/plinth/modules/snapshot/urls.py @@ -25,7 +25,8 @@ from . import views urlpatterns = [ url(r'^sys/snapshot/$', views.index, name='index'), url(r'^sys/snapshot/manage/$', views.manage, name='manage'), - url(r'^sys/snapshot/selected/delete$', views.delete_selected, name='delete-selected'), + url(r'^sys/snapshot/selected/delete$', views.delete_selected, + name='delete-selected'), url(r'^sys/snapshot/(?P\d+)/rollback$', views.rollback, name='rollback'), ] diff --git a/plinth/modules/snapshot/views.py b/plinth/modules/snapshot/views.py index 0569b8b96..3643f2041 100644 --- a/plinth/modules/snapshot/views.py +++ b/plinth/modules/snapshot/views.py @@ -137,7 +137,8 @@ def update_configuration(request, old_status, new_status): ('free_space', 'FREE_LIMIT={}'), ])) - if old_status['enable_software_snapshots'] != new_status['enable_software_snapshots']: + if old_status['enable_software_snapshots'] != new_status[ + 'enable_software_snapshots']: if new_status['enable_software_snapshots'] == 'yes': actions.superuser_run('snapshot', ['disable-apt-snapshot', 'no']) else: diff --git a/plinth/modules/ssh/__init__.py b/plinth/modules/ssh/__init__.py index d5da191a1..7d3911cbd 100644 --- a/plinth/modules/ssh/__init__.py +++ b/plinth/modules/ssh/__init__.py @@ -27,7 +27,7 @@ from plinth.daemon import Daemon from plinth.modules.firewall.components import Firewall from plinth.views import AppView -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/sso/forms.py b/plinth/modules/sso/forms.py index fb2b095d5..19f31783c 100644 --- a/plinth/modules/sso/forms.py +++ b/plinth/modules/sso/forms.py @@ -18,7 +18,9 @@ Forms for the Single Sign On app of FreedomBox. """ -from django.contrib.auth.forms import AuthenticationForm as DjangoAuthenticationForm +from django.contrib.auth.forms import ( + AuthenticationForm as DjangoAuthenticationForm +) from captcha.fields import CaptchaField diff --git a/plinth/modules/storage/__init__.py b/plinth/modules/storage/__init__.py index 3c6dd5274..d488e8c4e 100644 --- a/plinth/modules/storage/__init__.py +++ b/plinth/modules/storage/__init__.py @@ -23,7 +23,7 @@ import subprocess import psutil from django.utils.translation import ugettext_lazy as _ -from plinth import action_utils, actions +from plinth import actions from plinth import app as app_module from plinth import cfg, menu, utils from plinth.daemon import Daemon diff --git a/plinth/modules/syncthing/__init__.py b/plinth/modules/syncthing/__init__.py index 37567cd8c..358b18494 100644 --- a/plinth/modules/syncthing/__init__.py +++ b/plinth/modules/syncthing/__init__.py @@ -29,7 +29,7 @@ from plinth.modules.firewall.components import Firewall from plinth.modules.users import register_group from plinth.utils import format_lazy -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 2 diff --git a/plinth/modules/tahoe/__init__.py b/plinth/modules/tahoe/__init__.py index 9eeea62e6..a3fb8e1a4 100644 --- a/plinth/modules/tahoe/__init__.py +++ b/plinth/modules/tahoe/__init__.py @@ -32,7 +32,7 @@ from plinth.modules.firewall.components import Firewall from plinth.utils import format_lazy from .errors import TahoeConfigurationError -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/tor/__init__.py b/plinth/modules/tor/__init__.py index 823051cb2..d638b6c81 100644 --- a/plinth/modules/tor/__init__.py +++ b/plinth/modules/tor/__init__.py @@ -31,7 +31,7 @@ from plinth.modules.names import SERVICES from plinth.signals import domain_added, domain_removed from . import utils -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 3 diff --git a/plinth/modules/transmission/__init__.py b/plinth/modules/transmission/__init__.py index be5c47b55..0a88a39eb 100644 --- a/plinth/modules/transmission/__init__.py +++ b/plinth/modules/transmission/__init__.py @@ -30,7 +30,7 @@ from plinth.modules.apache.components import Webserver from plinth.modules.firewall.components import Firewall from plinth.modules.users import register_group -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 2 diff --git a/plinth/modules/ttrss/__init__.py b/plinth/modules/ttrss/__init__.py index 381d72ea5..3b6d747c6 100644 --- a/plinth/modules/ttrss/__init__.py +++ b/plinth/modules/ttrss/__init__.py @@ -30,7 +30,7 @@ from plinth.modules.firewall.components import Firewall from plinth.modules.users import register_group from plinth.utils import Version, format_lazy -from .manifest import backup, clients +from .manifest import backup, clients # noqa, pylint: disable=unused-import version = 3 diff --git a/plinth/modules/upgrades/__init__.py b/plinth/modules/upgrades/__init__.py index 8270c382e..90ff53f85 100644 --- a/plinth/modules/upgrades/__init__.py +++ b/plinth/modules/upgrades/__init__.py @@ -24,7 +24,7 @@ from plinth import actions from plinth import app as app_module from plinth import menu -from .manifest import backup +from .manifest import backup # noqa, pylint: disable=unused-import version = 1 diff --git a/plinth/modules/users/views.py b/plinth/modules/users/views.py index d35b2fab8..29a7e0fc9 100644 --- a/plinth/modules/users/views.py +++ b/plinth/modules/users/views.py @@ -159,7 +159,8 @@ class UserDelete(ContextMixin, DeleteView): messages.success(self.request, message) try: - actions.superuser_run('users', ['remove-user', self.kwargs['slug']]) + actions.superuser_run( + 'users', ['remove-user', self.kwargs['slug']]) except ActionError: messages.error(self.request, _('Deleting LDAP user failed.')) diff --git a/plinth/tests/config.py b/plinth/tests/config.py index daf3993fb..d4e09d8f8 100644 --- a/plinth/tests/config.py +++ b/plinth/tests/config.py @@ -32,6 +32,6 @@ backups_ssh_repo_uuid = 'plinth_test_sshfs' # will be mounted to /media/ # Import config_local to override the default variables try: - from .config_local import * + from .config_local import * # noqa, pylint: disable=unused-import except ImportError: pass