Merge "Enable pep8 checks on monasca-ui"

This commit is contained in:
Jenkins 2016-12-14 05:58:09 +00:00 committed by Gerrit Code Review
commit 0ddaa83452
12 changed files with 35 additions and 23 deletions

View File

@ -45,8 +45,7 @@ class EditAlarm(tables.LinkAction):
def get_link_url(self, datum):
return urlresolvers.reverse(constants.URL_PREFIX + 'alarm_edit',
args=(
datum['id'], ))
args=(datum['id'], ))
def allowed(self, request, datum=None):
return True
@ -96,4 +95,4 @@ class AlarmsTable(tables.DataTable):
table_actions = (CreateAlarm,
AlarmsFilterAction,
DeleteAlarm,
)
)

View File

@ -25,11 +25,11 @@ from monitoring.alarmdefs import workflows
INDEX_URL = urlresolvers.reverse(
constants.URL_PREFIX + 'index')
CREATE_URL = urlresolvers.reverse(
constants.URL_PREFIX + 'alarm_create', args=())
constants.URL_PREFIX + 'alarm_create', args=())
DETAIL_URL = urlresolvers.reverse(
constants.URL_PREFIX + 'alarm_detail', args=('12345',))
constants.URL_PREFIX + 'alarm_detail', args=('12345',))
EDIT_URL = urlresolvers.reverse(
constants.URL_PREFIX + 'alarm_edit', args=('12345',))
constants.URL_PREFIX + 'alarm_edit', args=('12345',))
class AlarmDefinitionsTest(helpers.TestCase):

View File

@ -46,7 +46,7 @@ class IndexView(tables.DataTableView):
results = []
if page_offset is None:
page_offset = 0
limit = utils.get_page_size(self.request)
limit = utils.get_page_size(self.request)
try:
results = api.monitor.alarmdef_list(self.request, page_offset, limit)
paginator = Paginator(results, limit)

View File

@ -49,7 +49,6 @@ class ExpressionWidget(forms.Widget):
return t.render(context)
class SimpleExpressionWidget(django_forms.MultiWidget):
def __init__(self, initial, attrs=None):
comparators = [('>', '>'), ('>=', '>='), ('<', '<'), ('<=', '<=')]

View File

@ -61,9 +61,11 @@ def show_severity(data):
else:
return state.upper()
def show_alarm_id(data):
return data['id']
def show_metric_name(data):
return data['metrics'][0]['name']
@ -212,7 +214,6 @@ class AlarmsFilterAction(tables.LinkAction):
policy_rules = (("alarm", "alarm:filter"),)
ajax = True
def get_link_url(self):
return urlresolvers.reverse(constants.URL_PREFIX + 'alarm_filter',
args=())

View File

@ -8,9 +8,10 @@ from monitoring.alarms import constants
INDEX_URL = urlresolvers.reverse(
constants.URL_PREFIX + 'index')
ALARMS_URL_BY_DIMENSION = urlresolvers.reverse(
constants.URL_PREFIX + 'alarm', args=('nova',))
constants.URL_PREFIX + 'alarm', args=('nova',))
ALARMS_URL = urlresolvers.reverse(
constants.URL_PREFIX + 'alarm', args=('all',))
constants.URL_PREFIX + 'alarm', args=('all',))
class AlarmsTest(helpers.TestCase):
def test_alarms_get_by_dimension(self):

View File

@ -23,7 +23,7 @@ class NotificationType(object):
CHOICES = [(EMAIL, _("Email")),
(WEBHOOK, _("Webhook")),
(PAGERDUTY, _("PagerDuty")),]
(PAGERDUTY, _("PagerDuty")), ]
@staticmethod
def get_label(key):

View File

@ -10,7 +10,7 @@ INDEX_URL = urlresolvers.reverse(
CREATE_URL = urlresolvers.reverse(
constants.URL_PREFIX + 'notification_create')
EDIT_URL = urlresolvers.reverse(
constants.URL_PREFIX + 'notification_edit', args=('12345',))
constants.URL_PREFIX + 'notification_edit', args=('12345',))
class AlarmsTest(helpers.TestCase):

View File

@ -28,7 +28,7 @@ class KibanaProxyViewTest(helpers.TestCase):
self.request_factory = RequestFactory()
def test_get_relative_url_with_unicode(self):
"""Tests if it properly converts multibyte characters"""
"""Tests if it properly converts multibyte characters."""
import urlparse
self.view.request = self.request_factory.get(

View File

@ -47,7 +47,7 @@ STATUS_FA_ICON_MAP = {'btn-success': "fa-check",
def get_icon(status):
return STATUS_FA_ICON_MAP.get(status, "fa-question-circle")
return STATUS_FA_ICON_MAP.get(status, "fa-question-circle")
priorities = [

View File

@ -17,11 +17,15 @@ monasca = {
"name": "Monitoring",
"endpoints_links": [],
"endpoints": [
{"region": "RegionOne",
"adminURL": "http://admin.monasca.example.com:8386/v1.1",
"publicURL": "http://public.monasca.example.com:8386/v1.1",
"internalURL": "http://int.monasca.example.com:8386/v1.1"}]}
{"region": "RegionOne",
"adminURL": "http://admin.monasca.example.com:8386/v1.1",
"publicURL": "http://public.monasca.example.com:8386/v1.1",
"internalURL": "http://int.monasca.example.com:8386/v1.1"}]
}
keystone_data.SERVICE_CATALOG.append(monasca)
def data(TEST):
pass

16
tox.ini
View File

@ -28,8 +28,16 @@ builtins = _
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*
# E127 continuation line over-indented for visual indent
# E128 continuation line under-indented for visual indent
# H701 empty localization string
# H702 Formatting operation should be outside of localization method call
# E501 line too long
# F401 imported but unused
# F841 local variable is assigned to but never used
# H102 Apache 2.0 license header not found
# H238 old style class declaration, use new style
# H301 one import per line
# H305 imports not grouped correctly
# H306 imports not in alphabetical order
# H307 like imports should be grouped together
# H405 multi line docstring summary not separated with an empty line
# H803 git commit title should not end with period (disabled on purpose, see bug #1236621)
ignore = E127,E128,H701,H702,H803
select = H236
# H904 Wrap long lines in parentheses instead of a backslash
ignore = E127,E128,E501,F401,F841,H102,H238,H301,H305,H306,H307,H405,H803,H904