Fix a few minor annoyances that snuck in

We had the normal infra pep8 ignores marked, but follow some of them by hand
in this codebase anyway. While E12* are not valid pep8, the prevailing style
of shade is in agreement with them. While we weren't enforcing them, a few
instances snuck in. Fix them and just turn the flags on.

Change-Id: Iea2bd9a99eb8b20dd40418ac8479b809d3872de8
This commit is contained in:
Monty Taylor 2017-03-15 18:06:28 +01:00
parent 8aa8688ba8
commit c9e9ef9f43
No known key found for this signature in database
GPG Key ID: 7BAE94BC7141A594
7 changed files with 16 additions and 19 deletions

View File

@ -2121,8 +2121,7 @@ class OpenStackCloud(_normalize.Normalizer):
external_ipv4_networks.append(network)
# External Floating IPv4 networks
if ('router:external' in network
and network['router:external']):
if ('router:external' in network and network['router:external']):
external_ipv4_floating_networks.append(network)
# Internal networks
@ -3016,7 +3015,7 @@ class OpenStackCloud(_normalize.Normalizer):
if interface_type:
filtered_ports = []
if (router.get('external_gateway_info') and
'external_fixed_ips' in router['external_gateway_info']):
'external_fixed_ips' in router['external_gateway_info']):
ext_fixed = \
router['external_gateway_info']['external_fixed_ips']
else:
@ -4013,7 +4012,7 @@ class OpenStackCloud(_normalize.Normalizer):
for count in _utils._iterate_timeout(
timeout,
"Timeout waiting for the volume snapshot to be available."
):
):
snapshot = self.get_volume_snapshot_by_id(snapshot_id)
if snapshot['status'] == 'available':
@ -5862,7 +5861,7 @@ class OpenStackCloud(_normalize.Normalizer):
return segment_size
def is_object_stale(
self, container, name, filename, file_md5=None, file_sha256=None):
self, container, name, filename, file_md5=None, file_sha256=None):
metadata = self.get_object_metadata(container, name)
if not metadata:
@ -5998,7 +5997,8 @@ class OpenStackCloud(_normalize.Normalizer):
entry['etag'] = result.headers['Etag']
def _upload_large_object(
self, endpoint, filename, headers, file_size, segment_size, use_slo):
self, endpoint, filename,
headers, file_size, segment_size, use_slo):
# If the object is big, we need to break it up into segments that
# are no larger than segment_size, upload each of them individually
# and then upload a manifest object. The segments can be uploaded in

View File

@ -1150,7 +1150,7 @@ class OperatorCloud(openstackcloud.OpenStackCloud):
domain_id = dom['id']
with _utils.shade_exceptions(
"Failed to delete domain {id}".format(id=domain_id)):
"Failed to delete domain {id}".format(id=domain_id)):
# Deleting a domain is expensive, so disabling it first increases
# the changes of success
domain = self.update_domain(domain_id, enabled=False)

View File

@ -103,8 +103,8 @@ class TestEndpoints(base.BaseFunctionalTestCase):
self.assertIsNotNone(endpoints[0].get('id'))
def test_update_endpoint(self):
if self.operator_cloud.cloud_config.get_api_version(
'identity').startswith('2'):
ver = self.operator_cloud.cloud_config.get_api_version('identity')
if ver.startswith('2'):
# NOTE(SamYaple): Update endpoint only works with v3 api
self.assertRaises(OpenStackCloudUnavailableFeature,
self.operator_cloud.update_endpoint,

View File

@ -66,8 +66,7 @@ class TestObject(base.BaseFunctionalTestCase):
self.assertFalse(self.user_cloud.is_object_stale(
container_name, name,
fake_file.name
)
)
))
self.assertEqual(
'bar', self.user_cloud.get_object_metadata(
container_name, name)['x-object-meta-foo']
@ -131,8 +130,7 @@ class TestObject(base.BaseFunctionalTestCase):
self.assertFalse(self.user_cloud.is_object_stale(
container_name, name,
fake_file.name
)
)
))
self.assertEqual(
'bar', self.user_cloud.get_object_metadata(
container_name, name)['x-object-meta-foo']

View File

@ -65,8 +65,8 @@ class TestServices(base.BaseFunctionalTestCase):
self.assertIsNotNone(service.get('id'))
def test_update_service(self):
if self.operator_cloud.cloud_config.get_api_version(
'identity').startswith('2'):
ver = self.operator_cloud.cloud_config.get_api_version('identity')
if ver.startswith('2'):
# NOTE(SamYaple): Update service only works with v3 api
self.assertRaises(OpenStackCloudUnavailableFeature,
self.operator_cloud.update_service,

View File

@ -98,7 +98,7 @@ class TestUtils(base.TestCase):
data, u'中文',
{'other': {
'financial': {'status': 'rich'}
}})
}})
self.assertEqual([el2], ret)
def test__filter_list_filter(self):
@ -139,7 +139,7 @@ class TestUtils(base.TestCase):
data, 'donald',
{'other': {
'financial': {'status': 'rich'}
}})
}})
self.assertEqual([el2, el3], ret)
def test_safe_dict_min_ints(self):

View File

@ -67,10 +67,9 @@ commands = python setup.py build_sphinx
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
[flake8]
# Infra does not follow hacking, nor the broken E12* things
# The string of H ignores is because there are some useful checks
# related to python3 compat.
ignore = E123,E125,E129,H3,H4,H5,H6,H7,H8,H103,H201,H238
ignore = H3,H4,H5,H6,H7,H8,H103,H201,H238
show-source = True
builtins = _
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build