Fix some flake8 warnings
fix and enable: - E121 continuation line under-indented for hanging indent - E126 continuation line over-indented for hanging indent - E226 missing whitespace around arithmetic operator - H306 imports not in alphabetical order - H401 docstring should not start with a space Change-Id: I1dab6908652924931e750187380d153d64eba2b6
This commit is contained in:
parent
310b86b076
commit
a9a49899c2
@ -74,16 +74,16 @@ QUOTA_TASK = collections.namedtuple(
|
||||
# IMPORTANT_QUOTAS = {<service>: [<quota_name>], }
|
||||
IMPORTANT_QUOTAS = {
|
||||
'nova': [
|
||||
'instances', 'cores', 'ram',
|
||||
'instances', 'cores', 'ram',
|
||||
],
|
||||
'cinder': [
|
||||
'volumes', 'snapshots', 'gigabytes',
|
||||
],
|
||||
'neutron': [
|
||||
'network', 'floatingip', 'router', 'security_group',
|
||||
'network', 'floatingip', 'router', 'security_group',
|
||||
],
|
||||
'octavia': [
|
||||
'load_balancer',
|
||||
'load_balancer',
|
||||
],
|
||||
}
|
||||
|
||||
@ -511,18 +511,18 @@ def task_obj_get(request, task_id=None, task=None, page=0):
|
||||
valid = False not in [action['valid'] for
|
||||
action in task['actions']]
|
||||
return TASK(
|
||||
id=task['uuid'],
|
||||
task_type=task['task_type'],
|
||||
valid=valid,
|
||||
request_by=task['keystone_user'].get('username', '-'),
|
||||
request_project=task['keystone_user'].get('project_name', '-'),
|
||||
status=status,
|
||||
created_on=task['created_on'],
|
||||
approved_on=task['approved_on'],
|
||||
completed_on=task['completed_on'],
|
||||
actions=task['actions'],
|
||||
page=page
|
||||
)
|
||||
id=task['uuid'],
|
||||
task_type=task['task_type'],
|
||||
valid=valid,
|
||||
request_by=task['keystone_user'].get('username', '-'),
|
||||
request_project=task['keystone_user'].get('project_name', '-'),
|
||||
status=status,
|
||||
created_on=task['created_on'],
|
||||
approved_on=task['approved_on'],
|
||||
completed_on=task['completed_on'],
|
||||
actions=task['actions'],
|
||||
page=page
|
||||
)
|
||||
|
||||
|
||||
def task_cancel(request, task_id):
|
||||
@ -615,7 +615,7 @@ def quota_sizes_get(request, region=None):
|
||||
|
||||
|
||||
def size_details_get(request, size, region=None):
|
||||
""" Gets the current details of the size as well as the current region's
|
||||
"""Gets the current details of the size as well as the current region's
|
||||
quota
|
||||
"""
|
||||
quota_details = []
|
||||
@ -636,7 +636,7 @@ def size_details_get(request, size, region=None):
|
||||
usage = resp['regions'][0]['current_usage'][service].get(
|
||||
resource)
|
||||
try:
|
||||
percent = float(usage)/value
|
||||
percent = float(usage) / value
|
||||
except (TypeError, ZeroDivisionError):
|
||||
percent = '-'
|
||||
|
||||
@ -670,7 +670,7 @@ def quota_details_get(request, region):
|
||||
value = 'No Limit'
|
||||
usage = resp['regions'][0]['current_usage'][service].get(name)
|
||||
try:
|
||||
percent = float(usage)/value
|
||||
percent = float(usage) / value
|
||||
except (TypeError, ZeroDivisionError):
|
||||
percent = '-'
|
||||
|
||||
|
@ -17,9 +17,9 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import exceptions
|
||||
from horizon import tabs
|
||||
|
||||
from adjutant_ui.content.notifications import tables as notification_tables
|
||||
from adjutant_ui.api import adjutant
|
||||
from adjutant_ui.api.adjutant import AdjutantApiError
|
||||
from adjutant_ui.content.notifications import tables as notification_tables
|
||||
|
||||
|
||||
class UnacknowledgedNotificationsTab(tabs.TableTab):
|
||||
@ -47,8 +47,8 @@ class UnacknowledgedNotificationsTab(tabs.TableTab):
|
||||
self._page = 1
|
||||
notifications, self._prev, self._more = \
|
||||
adjutant.notification_list(
|
||||
self.request, filters=self.filters,
|
||||
page=self._page)
|
||||
self.request, filters=self.filters,
|
||||
page=self._page)
|
||||
except Exception:
|
||||
exceptions.handle(
|
||||
self.request, _('Failed to list notifications.'))
|
||||
|
@ -16,14 +16,14 @@ from django.urls import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import views
|
||||
from horizon import tabs
|
||||
from horizon import views
|
||||
|
||||
from horizon.utils import memoized
|
||||
|
||||
from adjutant_ui.content.notifications import tabs as notification_tab
|
||||
from adjutant_ui.content.notifications import tables as notification_tables
|
||||
from adjutant_ui.api import adjutant
|
||||
from adjutant_ui.content.notifications import tables as notification_tables
|
||||
from adjutant_ui.content.notifications import tabs as notification_tab
|
||||
|
||||
|
||||
class IndexView(tabs.TabbedTableView):
|
||||
|
@ -20,9 +20,9 @@ from horizon import exceptions
|
||||
from horizon import forms
|
||||
from horizon import tables as horizon_tables
|
||||
|
||||
from adjutant_ui.api import adjutant
|
||||
from adjutant_ui.content.quota import forms as quota_forms
|
||||
from adjutant_ui.content.quota import tables as quota_tables
|
||||
from adjutant_ui.api import adjutant
|
||||
|
||||
|
||||
class IndexView(horizon_tables.MultiTableView):
|
||||
|
@ -17,8 +17,8 @@ from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import exceptions
|
||||
from horizon import tabs
|
||||
|
||||
from adjutant_ui.content.tasks import tables as task_tables
|
||||
from adjutant_ui.api import adjutant
|
||||
from adjutant_ui.content.tasks import tables as task_tables
|
||||
|
||||
|
||||
class ActiveTaskListTab(tabs.TableTab):
|
||||
|
@ -21,10 +21,10 @@ from horizon import tabs
|
||||
|
||||
from horizon.utils import memoized
|
||||
|
||||
from adjutant_ui.content.tasks import tables as task_tables
|
||||
from adjutant_ui.content.tasks import forms as task_forms
|
||||
from adjutant_ui.content.tasks import tabs as task_tabs
|
||||
from adjutant_ui.api import adjutant
|
||||
from adjutant_ui.content.tasks import forms as task_forms
|
||||
from adjutant_ui.content.tasks import tables as task_tables
|
||||
from adjutant_ui.content.tasks import tabs as task_tabs
|
||||
|
||||
import json
|
||||
|
||||
|
4
tox.ini
4
tox.ini
@ -55,8 +55,8 @@ commands = python setup.py build_sphinx
|
||||
|
||||
[flake8]
|
||||
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*,.ropeproject,node_modules
|
||||
# these are currently not passing, should be removed once code is changed
|
||||
ignore = E121,E126,E226,F405,H102,H301,H306,H401,H405,H701,H702
|
||||
# These are currently not passing, should be removed once code is changed
|
||||
ignore = F405,H102,H301,H405,H701,H702
|
||||
max-complexity = 20
|
||||
|
||||
[hacking]
|
||||
|
Loading…
x
Reference in New Issue
Block a user