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:
Dina Belova 2014-06-25 12:47:56 +04:00
parent 7b2bea56f3
commit c3c4839514
10 changed files with 53 additions and 55 deletions

View File

@ -240,7 +240,7 @@ class PartitionCoordinator(object):
still_ahead = self.this < self.oldest
self.last_alarms = set(alarms)
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
def check_mastership(self, eval_interval, api_client):

View File

@ -117,8 +117,8 @@ class _Base(plugin.ComputePollster):
class _RateBase(_Base):
NET_USAGE_MESSAGE = ' '.join(["NETWORK RATE:", "%s %s:",
"read-bytes-rate=%d",
"write-bytes-rate=%d"])
"read-bytes-rate=%d",
"write-bytes-rate=%d"])
CACHE_KEY_VNIC = 'vnic-rates'

View File

@ -95,8 +95,8 @@ class SNMPInspector(base.Inspector):
(error, data) = parse_snmp_return(ret)
if error:
raise SNMPException("An error occurred, oid %(oid)s, "
"host %(host)s, %(err)s" % dict(oid=oid,
host=host.hostname, err=data))
"host %(host)s, %(err)s" %
dict(oid=oid, host=host.hostname, err=data))
else:
return ret_func(data)

View File

@ -37,16 +37,16 @@ def _handle_meter_indices(meta, downgrade=False):
fk_params = [({'columns': [meter.c.resource_id],
'refcolumns': [resource.c.id]},
'fk_meter_resource_id',
'fk_sample_resource_id'),
'fk_meter_resource_id',
'fk_sample_resource_id'),
({'columns': [meter.c.project_id],
'refcolumns': [project.c.id]},
'fk_meter_project_id',
'fk_sample_project_id'),
'fk_meter_project_id',
'fk_sample_project_id'),
({'columns': [meter.c.user_id],
'refcolumns': [user.c.id]},
'fk_meter_user_id',
'fk_sample_user_id')]
'fk_meter_user_id',
'fk_sample_user_id')]
for fk in fk_params:
params = fk[0]

View File

@ -88,16 +88,16 @@ class TestEvaluate(base.TestEvaluatorBase):
def _combination_transition_reason(self, state, alarm_ids1, alarm_ids2):
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)},
('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)}],
[self._reason_data(alarm_ids1), self._reason_data(alarm_ids2)])
def _combination_remaining_reason(self, state, alarm_ids1, alarm_ids2):
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)},
('Remaining as %(state)s due to alarms %(alarm_ids)s'
' in state %(state)s')

View File

@ -44,21 +44,21 @@ class TestValidateUserInput(v2.FunctionalTest,
self.assertRaises(webtest.app.AppError, self.get_json,
'/meters/meter.test',
q=[{'field': 'metadata.util',
'op': 'eq',
'value': '0.7.5',
'type': 'float'}])
'op': 'eq',
'value': '0.7.5',
'type': 'float'}])
self.assertRaises(webtest.app.AppError, self.get_json,
'/meters/meter.test',
q=[{'field': 'metadata.util',
'op': 'eq',
'value': 'abacaba',
'type': 'boolean'}])
'op': 'eq',
'value': 'abacaba',
'type': 'boolean'}])
self.assertRaises(webtest.app.AppError, self.get_json,
'/meters/meter.test',
q=[{'field': 'metadata.util',
'op': 'eq',
'value': '45.765',
'type': 'integer'}])
'op': 'eq',
'value': '45.765',
'type': 'integer'}])
class TestListMeters(v2.FunctionalTest,
@ -260,9 +260,9 @@ class TestListMeters(v2.FunctionalTest,
def test_list_meters_query_wrong_type_metadata(self):
resp = self.get_json('/meters/meter.test',
q=[{'field': 'metadata.size',
'op': 'eq',
'value': '0',
'type': 'blob'}],
'op': 'eq',
'value': '0',
'type': 'blob'}],
expect_errors=True
)
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):
data = self.get_json('/meters/meter.test',
q=[{'field': 'metadata.size',
'op': 'eq',
'value': '0',
'type': 'integer'}]
'op': 'eq',
'value': '0',
'type': 'integer'}]
)
self.assertEqual(2, len(data))
self.assertEqual(set(['resource-id',
@ -416,9 +416,9 @@ class TestListMeters(v2.FunctionalTest,
def test_list_meters_query_float_metadata(self):
data = self.get_json('/meters/meter.test',
q=[{'field': 'metadata.util',
'op': 'eq',
'value': '0.75',
'type': 'float'}]
'op': 'eq',
'value': '0.75',
'type': 'float'}]
)
self.assertEqual(2, len(data))
self.assertEqual(set(['resource-id',
@ -432,9 +432,9 @@ class TestListMeters(v2.FunctionalTest,
def test_list_meters_query_boolean_metadata(self):
data = self.get_json('/meters/meter.mine',
q=[{'field': 'metadata.is_public',
'op': 'eq',
'value': 'False',
'type': 'boolean'}]
'op': 'eq',
'value': 'False',
'type': 'boolean'}]
)
self.assertEqual(1, len(data))
self.assertEqual(set(['resource-id2']),
@ -448,8 +448,8 @@ class TestListMeters(v2.FunctionalTest,
def test_list_meters_query_string_metadata(self):
data = self.get_json('/meters/meter.test',
q=[{'field': 'metadata.tag',
'op': 'eq',
'value': 'self.sample'}]
'op': 'eq',
'value': 'self.sample'}]
)
self.assertEqual(1, len(data))
self.assertEqual(set(['resource-id']),

View File

@ -148,7 +148,7 @@ class TestLibvirtInspection(test.BaseTestCase):
side_effect=interfaceStats),
mock.patch.object(self.domain, 'info',
return_value=(0L, 0L, 0L,
2L, 999999L))):
2L, 999999L))):
interfaces = list(self.inspector.inspect_vnics(self.instance_name))
self.assertEqual(3, len(interfaces))
@ -194,7 +194,7 @@ class TestLibvirtInspection(test.BaseTestCase):
return_value=self.domain),
mock.patch.object(self.domain, 'info',
return_value=(5L, 0L, 0L,
2L, 999999L))):
2L, 999999L))):
interfaces = list(self.inspector.inspect_vnics(self.instance_name))
self.assertEqual(interfaces, [])
@ -221,10 +221,10 @@ class TestLibvirtInspection(test.BaseTestCase):
return_value=dom_xml),
mock.patch.object(self.domain, 'blockStats',
return_value=(1L, 2L, 3L,
4L, -1)),
4L, -1)),
mock.patch.object(self.domain, 'info',
return_value=(0L, 0L, 0L,
2L, 999999L))):
2L, 999999L))):
disks = list(self.inspector.inspect_disks(self.instance_name))
self.assertEqual(1, len(disks))
@ -241,7 +241,7 @@ class TestLibvirtInspection(test.BaseTestCase):
return_value=self.domain),
mock.patch.object(self.domain, 'info',
return_value=(5L, 0L, 0L,
2L, 999999L))):
2L, 999999L))):
disks = list(self.inspector.inspect_disks(self.instance_name))
self.assertEqual(disks, [])

View File

@ -186,11 +186,11 @@ class RelationshipTest(scenarios.DBTestBase):
meta_tables = [sql_models.MetaText, sql_models.MetaFloat,
sql_models.MetaBigInt, sql_models.MetaBool]
for table in meta_tables:
self.assertEqual(0, session.query(table)
.filter(~table.id.in_(
session.query(sql_models.Sample.id)
.group_by(sql_models.Sample.id)
)).count())
self.assertEqual(0, (session.query(table)
.filter(~table.id.in_(
session.query(sql_models.Sample.id)
.group_by(sql_models.Sample.id))).count()
))
class CapabilitiesTest(test_base.BaseTestCase):

View File

@ -934,7 +934,7 @@ class ComplexSampleQueryTest(DBTestBase,
for sample in results:
self.assertTrue((sample.resource_metadata["a_string_key"] ==
"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)
def test_query_mixed_data_and_metadata_filter(self):
@ -952,7 +952,7 @@ class ComplexSampleQueryTest(DBTestBase,
for sample in results:
self.assertTrue((sample.resource_metadata["a_string_key"] ==
"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")
def test_query_non_existing_metadata_with_result(self):
@ -2545,7 +2545,7 @@ class ComplexAlarmQueryTest(AlarmTestBase,
[{"or":
[{"=": {"name": "yellow-alert"}},
{"=": {"name": "red-alert"}}]},
{"=": {"enabled": True}}]}
{"=": {"enabled": True}}]}
result = list(self.conn.query_alarms(filter_expr=filter_expr))
@ -2566,9 +2566,8 @@ class ComplexAlarmQueryTest(AlarmTestBase,
def test_filter_and_orderby(self):
self.add_some_alarms()
result = list(self.conn.query_alarms(filter_expr={"=":
{"enabled":
True}},
result = list(self.conn.query_alarms(filter_expr=
{"=": {"enabled": True}},
orderby=[{"name": "asc"}]))
self.assertEqual(2, len(result))
self.assertEqual(["orange-alert", "red-alert"],

View File

@ -37,7 +37,6 @@ commands = python setup.py build_sphinx
commands = {posargs}
[flake8]
# E128 continuation line under-indented for visual indent
# E251 unexpected spaces around keyword / parameter equals
# E265 block comment should start with #
# F402 import module shadowed by loop variable
@ -45,7 +44,7 @@ commands = {posargs}
# H307 like imports should be grouped together
# H405 multi line docstring summary not separated with an empty line
# 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 = _
exclude=.venv,.git,.tox,dist,doc,./ceilometer/openstack/common,*lib/python*,*egg,tools,nova_tests,build
show-source = True