From 47a8febdbc2a7b31ed9b1dc3302ecb16a166d981 Mon Sep 17 00:00:00 2001 From: jacky06 Date: Fri, 4 Jan 2019 23:26:15 +0800 Subject: [PATCH] Update hacking version Use latest release 1.1.0 and compatible changes w.r.t pep8 Change-Id: I61f95439c6d79cd7bcc15badb729e4b8278cf37e --- test-requirements.txt | 2 +- tox.ini | 4 +++- trove_dashboard/content/databases/tables.py | 26 ++++++++++----------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 7a4fac6..b461b06 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,7 +2,7 @@ # of appearance. Changing the order has an impact on the overall integration # process, which may cause wedges in the gate later. -hacking<0.11,>=0.10.0 +hacking>=1.1.0,<1.2.0 # Apache-2.0 coverage>=3.6 ddt>=0.7.0 mock>=1.2 diff --git a/tox.ini b/tox.ini index c00c6e2..6854896 100644 --- a/tox.ini +++ b/tox.ini @@ -50,7 +50,9 @@ commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasen [flake8] show-source = True +# F405 TEMPLATES may be undefined, or defined from star imports +# (because it is not easy to avoid this in openstack_dashboard.test.settings) # H405 multi line docstring summary not separated with an empty line -ignore = H405 +ignore = F405,H405 builtins = _ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,.ropeproject,tools,releasenotes,.tmp diff --git a/trove_dashboard/content/databases/tables.py b/trove_dashboard/content/databases/tables.py index cf25d80..c638b11 100644 --- a/trove_dashboard/content/databases/tables.py +++ b/trove_dashboard/content/databases/tables.py @@ -84,9 +84,9 @@ class RestartInstance(tables.BatchAction): classes = ('btn-danger', 'btn-reboot') def allowed(self, request, instance=None): - return ((instance.status in ACTIVE_STATES - or instance.status == 'SHUTDOWN' - or instance.status == 'RESTART_REQUIRED')) + return ((instance.status in ACTIVE_STATES or + instance.status == 'SHUTDOWN' or + instance.status == 'RESTART_REQUIRED')) def action(self, request, obj_id): api.trove.instance_restart(request, obj_id) @@ -113,8 +113,8 @@ class DetachReplica(tables.BatchAction): classes = ('btn-danger', 'btn-detach-replica') def allowed(self, request, instance=None): - return (instance.status in ACTIVE_STATES - and hasattr(instance, 'replica_of')) + return (instance.status in ACTIVE_STATES and + hasattr(instance, 'replica_of')) def action(self, request, obj_id): api.trove.instance_detach_replica(request, obj_id) @@ -127,8 +127,8 @@ class PromoteToReplicaSource(tables.LinkAction): classes = ("ajax-modal", "btn-promote-to-replica-source") def allowed(self, request, instance=None): - return (instance.status in ACTIVE_STATES - and hasattr(instance, 'replica_of')) + return (instance.status in ACTIVE_STATES and + hasattr(instance, 'replica_of')) def get_link_url(self, datum): instance_id = self.table.get_object_id(datum) @@ -156,8 +156,8 @@ class EjectReplicaSource(tables.BatchAction): classes = ('btn-danger', 'btn-eject-replica-source') def _allowed(self, request, instance=None): - return (instance.status != 'PROMOTE' - and hasattr(instance, 'replicas')) + return (instance.status != 'PROMOTE' and + hasattr(instance, 'replicas')) def action(self, request, obj_id): api.trove.eject_replica_source(request, obj_id) @@ -436,8 +436,8 @@ class ResizeInstance(tables.LinkAction): classes = ("ajax-modal", "btn-resize") def allowed(self, request, instance=None): - return ((instance.status in ACTIVE_STATES - or instance.status == 'SHUTOFF')) + return ((instance.status in ACTIVE_STATES or + instance.status == 'SHUTOFF')) def get_link_url(self, datum): instance_id = self.table.get_object_id(datum) @@ -451,8 +451,8 @@ class AttachConfiguration(tables.LinkAction): classes = ("btn-attach-config", "ajax-modal") def allowed(self, request, instance=None): - return (instance.status in ACTIVE_STATES - and not hasattr(instance, 'configuration')) + return (instance.status in ACTIVE_STATES and + not hasattr(instance, 'configuration')) class DetachConfiguration(tables.BatchAction):