Fix E128 violations and re-enable gating
E128 got stricter in hacking 0.9, so fix new violations and re-enable gating. Change-Id: Id061f154f97d78bbbcd8704e6213034cce90a841
This commit is contained in:
parent
7b2bea56f3
commit
c3c4839514
@ -240,7 +240,7 @@ class PartitionCoordinator(object):
|
|||||||
still_ahead = self.this < self.oldest
|
still_ahead = self.this < self.oldest
|
||||||
self.last_alarms = set(alarms)
|
self.last_alarms = set(alarms)
|
||||||
LOG.info(_('%(this)s not overtaken as master? %(still_ahead)s') %
|
LOG.info(_('%(this)s not overtaken as master? %(still_ahead)s') %
|
||||||
({'this': self.this, 'still_ahead': still_ahead}))
|
({'this': self.this, 'still_ahead': still_ahead}))
|
||||||
return still_ahead
|
return still_ahead
|
||||||
|
|
||||||
def check_mastership(self, eval_interval, api_client):
|
def check_mastership(self, eval_interval, api_client):
|
||||||
|
@ -117,8 +117,8 @@ class _Base(plugin.ComputePollster):
|
|||||||
class _RateBase(_Base):
|
class _RateBase(_Base):
|
||||||
|
|
||||||
NET_USAGE_MESSAGE = ' '.join(["NETWORK RATE:", "%s %s:",
|
NET_USAGE_MESSAGE = ' '.join(["NETWORK RATE:", "%s %s:",
|
||||||
"read-bytes-rate=%d",
|
"read-bytes-rate=%d",
|
||||||
"write-bytes-rate=%d"])
|
"write-bytes-rate=%d"])
|
||||||
|
|
||||||
CACHE_KEY_VNIC = 'vnic-rates'
|
CACHE_KEY_VNIC = 'vnic-rates'
|
||||||
|
|
||||||
|
@ -95,8 +95,8 @@ class SNMPInspector(base.Inspector):
|
|||||||
(error, data) = parse_snmp_return(ret)
|
(error, data) = parse_snmp_return(ret)
|
||||||
if error:
|
if error:
|
||||||
raise SNMPException("An error occurred, oid %(oid)s, "
|
raise SNMPException("An error occurred, oid %(oid)s, "
|
||||||
"host %(host)s, %(err)s" % dict(oid=oid,
|
"host %(host)s, %(err)s" %
|
||||||
host=host.hostname, err=data))
|
dict(oid=oid, host=host.hostname, err=data))
|
||||||
else:
|
else:
|
||||||
return ret_func(data)
|
return ret_func(data)
|
||||||
|
|
||||||
|
@ -37,16 +37,16 @@ def _handle_meter_indices(meta, downgrade=False):
|
|||||||
|
|
||||||
fk_params = [({'columns': [meter.c.resource_id],
|
fk_params = [({'columns': [meter.c.resource_id],
|
||||||
'refcolumns': [resource.c.id]},
|
'refcolumns': [resource.c.id]},
|
||||||
'fk_meter_resource_id',
|
'fk_meter_resource_id',
|
||||||
'fk_sample_resource_id'),
|
'fk_sample_resource_id'),
|
||||||
({'columns': [meter.c.project_id],
|
({'columns': [meter.c.project_id],
|
||||||
'refcolumns': [project.c.id]},
|
'refcolumns': [project.c.id]},
|
||||||
'fk_meter_project_id',
|
'fk_meter_project_id',
|
||||||
'fk_sample_project_id'),
|
'fk_sample_project_id'),
|
||||||
({'columns': [meter.c.user_id],
|
({'columns': [meter.c.user_id],
|
||||||
'refcolumns': [user.c.id]},
|
'refcolumns': [user.c.id]},
|
||||||
'fk_meter_user_id',
|
'fk_meter_user_id',
|
||||||
'fk_sample_user_id')]
|
'fk_sample_user_id')]
|
||||||
|
|
||||||
for fk in fk_params:
|
for fk in fk_params:
|
||||||
params = fk[0]
|
params = fk[0]
|
||||||
|
@ -88,16 +88,16 @@ class TestEvaluate(base.TestEvaluatorBase):
|
|||||||
|
|
||||||
def _combination_transition_reason(self, state, alarm_ids1, alarm_ids2):
|
def _combination_transition_reason(self, state, alarm_ids1, alarm_ids2):
|
||||||
return ([('Transition to %(state)s due to alarms %(alarm_ids)s'
|
return ([('Transition to %(state)s due to alarms %(alarm_ids)s'
|
||||||
' in state %(state)s')
|
' in state %(state)s')
|
||||||
% {'state': state, 'alarm_ids': ",".join(alarm_ids1)},
|
% {'state': state, 'alarm_ids': ",".join(alarm_ids1)},
|
||||||
('Transition to %(state)s due to alarms %(alarm_ids)s'
|
('Transition to %(state)s due to alarms %(alarm_ids)s'
|
||||||
' in state %(state)s')
|
' in state %(state)s')
|
||||||
% {'state': state, 'alarm_ids': ",".join(alarm_ids2)}],
|
% {'state': state, 'alarm_ids': ",".join(alarm_ids2)}],
|
||||||
[self._reason_data(alarm_ids1), self._reason_data(alarm_ids2)])
|
[self._reason_data(alarm_ids1), self._reason_data(alarm_ids2)])
|
||||||
|
|
||||||
def _combination_remaining_reason(self, state, alarm_ids1, alarm_ids2):
|
def _combination_remaining_reason(self, state, alarm_ids1, alarm_ids2):
|
||||||
return ([('Remaining as %(state)s due to alarms %(alarm_ids)s'
|
return ([('Remaining as %(state)s due to alarms %(alarm_ids)s'
|
||||||
' in state %(state)s')
|
' in state %(state)s')
|
||||||
% {'state': state, 'alarm_ids': ",".join(alarm_ids1)},
|
% {'state': state, 'alarm_ids': ",".join(alarm_ids1)},
|
||||||
('Remaining as %(state)s due to alarms %(alarm_ids)s'
|
('Remaining as %(state)s due to alarms %(alarm_ids)s'
|
||||||
' in state %(state)s')
|
' in state %(state)s')
|
||||||
|
@ -44,21 +44,21 @@ class TestValidateUserInput(v2.FunctionalTest,
|
|||||||
self.assertRaises(webtest.app.AppError, self.get_json,
|
self.assertRaises(webtest.app.AppError, self.get_json,
|
||||||
'/meters/meter.test',
|
'/meters/meter.test',
|
||||||
q=[{'field': 'metadata.util',
|
q=[{'field': 'metadata.util',
|
||||||
'op': 'eq',
|
'op': 'eq',
|
||||||
'value': '0.7.5',
|
'value': '0.7.5',
|
||||||
'type': 'float'}])
|
'type': 'float'}])
|
||||||
self.assertRaises(webtest.app.AppError, self.get_json,
|
self.assertRaises(webtest.app.AppError, self.get_json,
|
||||||
'/meters/meter.test',
|
'/meters/meter.test',
|
||||||
q=[{'field': 'metadata.util',
|
q=[{'field': 'metadata.util',
|
||||||
'op': 'eq',
|
'op': 'eq',
|
||||||
'value': 'abacaba',
|
'value': 'abacaba',
|
||||||
'type': 'boolean'}])
|
'type': 'boolean'}])
|
||||||
self.assertRaises(webtest.app.AppError, self.get_json,
|
self.assertRaises(webtest.app.AppError, self.get_json,
|
||||||
'/meters/meter.test',
|
'/meters/meter.test',
|
||||||
q=[{'field': 'metadata.util',
|
q=[{'field': 'metadata.util',
|
||||||
'op': 'eq',
|
'op': 'eq',
|
||||||
'value': '45.765',
|
'value': '45.765',
|
||||||
'type': 'integer'}])
|
'type': 'integer'}])
|
||||||
|
|
||||||
|
|
||||||
class TestListMeters(v2.FunctionalTest,
|
class TestListMeters(v2.FunctionalTest,
|
||||||
@ -260,9 +260,9 @@ class TestListMeters(v2.FunctionalTest,
|
|||||||
def test_list_meters_query_wrong_type_metadata(self):
|
def test_list_meters_query_wrong_type_metadata(self):
|
||||||
resp = self.get_json('/meters/meter.test',
|
resp = self.get_json('/meters/meter.test',
|
||||||
q=[{'field': 'metadata.size',
|
q=[{'field': 'metadata.size',
|
||||||
'op': 'eq',
|
'op': 'eq',
|
||||||
'value': '0',
|
'value': '0',
|
||||||
'type': 'blob'}],
|
'type': 'blob'}],
|
||||||
expect_errors=True
|
expect_errors=True
|
||||||
)
|
)
|
||||||
expected_error_message = 'The data type blob is not supported.'
|
expected_error_message = 'The data type blob is not supported.'
|
||||||
@ -400,9 +400,9 @@ class TestListMeters(v2.FunctionalTest,
|
|||||||
def test_list_meters_query_integer_metadata(self):
|
def test_list_meters_query_integer_metadata(self):
|
||||||
data = self.get_json('/meters/meter.test',
|
data = self.get_json('/meters/meter.test',
|
||||||
q=[{'field': 'metadata.size',
|
q=[{'field': 'metadata.size',
|
||||||
'op': 'eq',
|
'op': 'eq',
|
||||||
'value': '0',
|
'value': '0',
|
||||||
'type': 'integer'}]
|
'type': 'integer'}]
|
||||||
)
|
)
|
||||||
self.assertEqual(2, len(data))
|
self.assertEqual(2, len(data))
|
||||||
self.assertEqual(set(['resource-id',
|
self.assertEqual(set(['resource-id',
|
||||||
@ -416,9 +416,9 @@ class TestListMeters(v2.FunctionalTest,
|
|||||||
def test_list_meters_query_float_metadata(self):
|
def test_list_meters_query_float_metadata(self):
|
||||||
data = self.get_json('/meters/meter.test',
|
data = self.get_json('/meters/meter.test',
|
||||||
q=[{'field': 'metadata.util',
|
q=[{'field': 'metadata.util',
|
||||||
'op': 'eq',
|
'op': 'eq',
|
||||||
'value': '0.75',
|
'value': '0.75',
|
||||||
'type': 'float'}]
|
'type': 'float'}]
|
||||||
)
|
)
|
||||||
self.assertEqual(2, len(data))
|
self.assertEqual(2, len(data))
|
||||||
self.assertEqual(set(['resource-id',
|
self.assertEqual(set(['resource-id',
|
||||||
@ -432,9 +432,9 @@ class TestListMeters(v2.FunctionalTest,
|
|||||||
def test_list_meters_query_boolean_metadata(self):
|
def test_list_meters_query_boolean_metadata(self):
|
||||||
data = self.get_json('/meters/meter.mine',
|
data = self.get_json('/meters/meter.mine',
|
||||||
q=[{'field': 'metadata.is_public',
|
q=[{'field': 'metadata.is_public',
|
||||||
'op': 'eq',
|
'op': 'eq',
|
||||||
'value': 'False',
|
'value': 'False',
|
||||||
'type': 'boolean'}]
|
'type': 'boolean'}]
|
||||||
)
|
)
|
||||||
self.assertEqual(1, len(data))
|
self.assertEqual(1, len(data))
|
||||||
self.assertEqual(set(['resource-id2']),
|
self.assertEqual(set(['resource-id2']),
|
||||||
@ -448,8 +448,8 @@ class TestListMeters(v2.FunctionalTest,
|
|||||||
def test_list_meters_query_string_metadata(self):
|
def test_list_meters_query_string_metadata(self):
|
||||||
data = self.get_json('/meters/meter.test',
|
data = self.get_json('/meters/meter.test',
|
||||||
q=[{'field': 'metadata.tag',
|
q=[{'field': 'metadata.tag',
|
||||||
'op': 'eq',
|
'op': 'eq',
|
||||||
'value': 'self.sample'}]
|
'value': 'self.sample'}]
|
||||||
)
|
)
|
||||||
self.assertEqual(1, len(data))
|
self.assertEqual(1, len(data))
|
||||||
self.assertEqual(set(['resource-id']),
|
self.assertEqual(set(['resource-id']),
|
||||||
|
@ -148,7 +148,7 @@ class TestLibvirtInspection(test.BaseTestCase):
|
|||||||
side_effect=interfaceStats),
|
side_effect=interfaceStats),
|
||||||
mock.patch.object(self.domain, 'info',
|
mock.patch.object(self.domain, 'info',
|
||||||
return_value=(0L, 0L, 0L,
|
return_value=(0L, 0L, 0L,
|
||||||
2L, 999999L))):
|
2L, 999999L))):
|
||||||
interfaces = list(self.inspector.inspect_vnics(self.instance_name))
|
interfaces = list(self.inspector.inspect_vnics(self.instance_name))
|
||||||
|
|
||||||
self.assertEqual(3, len(interfaces))
|
self.assertEqual(3, len(interfaces))
|
||||||
@ -194,7 +194,7 @@ class TestLibvirtInspection(test.BaseTestCase):
|
|||||||
return_value=self.domain),
|
return_value=self.domain),
|
||||||
mock.patch.object(self.domain, 'info',
|
mock.patch.object(self.domain, 'info',
|
||||||
return_value=(5L, 0L, 0L,
|
return_value=(5L, 0L, 0L,
|
||||||
2L, 999999L))):
|
2L, 999999L))):
|
||||||
interfaces = list(self.inspector.inspect_vnics(self.instance_name))
|
interfaces = list(self.inspector.inspect_vnics(self.instance_name))
|
||||||
self.assertEqual(interfaces, [])
|
self.assertEqual(interfaces, [])
|
||||||
|
|
||||||
@ -221,10 +221,10 @@ class TestLibvirtInspection(test.BaseTestCase):
|
|||||||
return_value=dom_xml),
|
return_value=dom_xml),
|
||||||
mock.patch.object(self.domain, 'blockStats',
|
mock.patch.object(self.domain, 'blockStats',
|
||||||
return_value=(1L, 2L, 3L,
|
return_value=(1L, 2L, 3L,
|
||||||
4L, -1)),
|
4L, -1)),
|
||||||
mock.patch.object(self.domain, 'info',
|
mock.patch.object(self.domain, 'info',
|
||||||
return_value=(0L, 0L, 0L,
|
return_value=(0L, 0L, 0L,
|
||||||
2L, 999999L))):
|
2L, 999999L))):
|
||||||
disks = list(self.inspector.inspect_disks(self.instance_name))
|
disks = list(self.inspector.inspect_disks(self.instance_name))
|
||||||
|
|
||||||
self.assertEqual(1, len(disks))
|
self.assertEqual(1, len(disks))
|
||||||
@ -241,7 +241,7 @@ class TestLibvirtInspection(test.BaseTestCase):
|
|||||||
return_value=self.domain),
|
return_value=self.domain),
|
||||||
mock.patch.object(self.domain, 'info',
|
mock.patch.object(self.domain, 'info',
|
||||||
return_value=(5L, 0L, 0L,
|
return_value=(5L, 0L, 0L,
|
||||||
2L, 999999L))):
|
2L, 999999L))):
|
||||||
disks = list(self.inspector.inspect_disks(self.instance_name))
|
disks = list(self.inspector.inspect_disks(self.instance_name))
|
||||||
self.assertEqual(disks, [])
|
self.assertEqual(disks, [])
|
||||||
|
|
||||||
|
@ -186,11 +186,11 @@ class RelationshipTest(scenarios.DBTestBase):
|
|||||||
meta_tables = [sql_models.MetaText, sql_models.MetaFloat,
|
meta_tables = [sql_models.MetaText, sql_models.MetaFloat,
|
||||||
sql_models.MetaBigInt, sql_models.MetaBool]
|
sql_models.MetaBigInt, sql_models.MetaBool]
|
||||||
for table in meta_tables:
|
for table in meta_tables:
|
||||||
self.assertEqual(0, session.query(table)
|
self.assertEqual(0, (session.query(table)
|
||||||
.filter(~table.id.in_(
|
.filter(~table.id.in_(
|
||||||
session.query(sql_models.Sample.id)
|
session.query(sql_models.Sample.id)
|
||||||
.group_by(sql_models.Sample.id)
|
.group_by(sql_models.Sample.id))).count()
|
||||||
)).count())
|
))
|
||||||
|
|
||||||
|
|
||||||
class CapabilitiesTest(test_base.BaseTestCase):
|
class CapabilitiesTest(test_base.BaseTestCase):
|
||||||
|
@ -934,7 +934,7 @@ class ComplexSampleQueryTest(DBTestBase,
|
|||||||
for sample in results:
|
for sample in results:
|
||||||
self.assertTrue((sample.resource_metadata["a_string_key"] ==
|
self.assertTrue((sample.resource_metadata["a_string_key"] ==
|
||||||
"meta-value0.81" or
|
"meta-value0.81" or
|
||||||
sample.resource_metadata["a_float_key"] <= 0.41))
|
sample.resource_metadata["a_float_key"] <= 0.41))
|
||||||
self.assertTrue(sample.resource_metadata["an_int_key"] > 42)
|
self.assertTrue(sample.resource_metadata["an_int_key"] > 42)
|
||||||
|
|
||||||
def test_query_mixed_data_and_metadata_filter(self):
|
def test_query_mixed_data_and_metadata_filter(self):
|
||||||
@ -952,7 +952,7 @@ class ComplexSampleQueryTest(DBTestBase,
|
|||||||
for sample in results:
|
for sample in results:
|
||||||
self.assertTrue((sample.resource_metadata["a_string_key"] ==
|
self.assertTrue((sample.resource_metadata["a_string_key"] ==
|
||||||
"meta-value0.81" or
|
"meta-value0.81" or
|
||||||
sample.resource_metadata["a_float_key"] <= 0.41))
|
sample.resource_metadata["a_float_key"] <= 0.41))
|
||||||
self.assertEqual(sample.resource_id, "resource-id-42")
|
self.assertEqual(sample.resource_id, "resource-id-42")
|
||||||
|
|
||||||
def test_query_non_existing_metadata_with_result(self):
|
def test_query_non_existing_metadata_with_result(self):
|
||||||
@ -2545,7 +2545,7 @@ class ComplexAlarmQueryTest(AlarmTestBase,
|
|||||||
[{"or":
|
[{"or":
|
||||||
[{"=": {"name": "yellow-alert"}},
|
[{"=": {"name": "yellow-alert"}},
|
||||||
{"=": {"name": "red-alert"}}]},
|
{"=": {"name": "red-alert"}}]},
|
||||||
{"=": {"enabled": True}}]}
|
{"=": {"enabled": True}}]}
|
||||||
|
|
||||||
result = list(self.conn.query_alarms(filter_expr=filter_expr))
|
result = list(self.conn.query_alarms(filter_expr=filter_expr))
|
||||||
|
|
||||||
@ -2566,9 +2566,8 @@ class ComplexAlarmQueryTest(AlarmTestBase,
|
|||||||
|
|
||||||
def test_filter_and_orderby(self):
|
def test_filter_and_orderby(self):
|
||||||
self.add_some_alarms()
|
self.add_some_alarms()
|
||||||
result = list(self.conn.query_alarms(filter_expr={"=":
|
result = list(self.conn.query_alarms(filter_expr=
|
||||||
{"enabled":
|
{"=": {"enabled": True}},
|
||||||
True}},
|
|
||||||
orderby=[{"name": "asc"}]))
|
orderby=[{"name": "asc"}]))
|
||||||
self.assertEqual(2, len(result))
|
self.assertEqual(2, len(result))
|
||||||
self.assertEqual(["orange-alert", "red-alert"],
|
self.assertEqual(["orange-alert", "red-alert"],
|
||||||
|
3
tox.ini
3
tox.ini
@ -37,7 +37,6 @@ commands = python setup.py build_sphinx
|
|||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
# E128 continuation line under-indented for visual indent
|
|
||||||
# E251 unexpected spaces around keyword / parameter equals
|
# E251 unexpected spaces around keyword / parameter equals
|
||||||
# E265 block comment should start with ‘# ‘
|
# E265 block comment should start with ‘# ‘
|
||||||
# F402 import module shadowed by loop variable
|
# F402 import module shadowed by loop variable
|
||||||
@ -45,7 +44,7 @@ commands = {posargs}
|
|||||||
# H307 like imports should be grouped together
|
# H307 like imports should be grouped together
|
||||||
# H405 multi line docstring summary not separated with an empty line
|
# H405 multi line docstring summary not separated with an empty line
|
||||||
# H904 Wrap long lines in parentheses instead of a backslash
|
# H904 Wrap long lines in parentheses instead of a backslash
|
||||||
ignore = E128,E251,E265,F402,H305,H307,H405,H904
|
ignore = E251,E265,F402,H305,H307,H405,H904
|
||||||
builtins = _
|
builtins = _
|
||||||
exclude=.venv,.git,.tox,dist,doc,./ceilometer/openstack/common,*lib/python*,*egg,tools,nova_tests,build
|
exclude=.venv,.git,.tox,dist,doc,./ceilometer/openstack/common,*lib/python*,*egg,tools,nova_tests,build
|
||||||
show-source = True
|
show-source = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user