Update pep8 rules

Remove E402 from flake8 list, issues are fixed or addressed with noqa.
Remove E305 as comment, the warning is enabled.
Enable E241 and fix all problems

Change-Id: Ifd2bbce98be4206908da769df686a370328c7ee1
This commit is contained in:
Andreas Jaeger 2020-04-30 16:23:24 +02:00
parent 21ed14736e
commit 7f770b95b8
17 changed files with 25 additions and 28 deletions

View File

@ -146,7 +146,7 @@ class ResourceEnforcer(Enforcer):
result = super(ResourceEnforcer, self).enforce(
context, res_type,
scope=scope or 'resource_types',
target=target, is_registered_policy=is_registered_policy)
target=target, is_registered_policy=is_registered_policy)
except policy.PolicyNotRegistered:
result = True
except self.exc as ex:

View File

@ -693,7 +693,7 @@ def _paginate_query(context, query, model, limit=None, sort_keys=None,
return query
def _query_stack_get_all(context, show_deleted=False,
def _query_stack_get_all(context, show_deleted=False,
show_nested=False, show_hidden=False, tags=None,
tags_any=None, not_tags=None, not_tags_any=None):
if show_nested:

View File

@ -41,7 +41,7 @@ class Host(resource.Resource):
)
ATTRIBUTES = (
HYPERVISOR_HOSTNAME, HYPERVISOR_TYPE, HYPERVISOR_VERSION,
HYPERVISOR_HOSTNAME, HYPERVISOR_TYPE, HYPERVISOR_VERSION,
VCPUS, CPU_INFO, MEMORY_MB, LOCAL_GB,
SERVICE_NAME, RESERVABLE, STATUS, TRUST_ID,
EXTRA_CAPABILITY_ATTR, CREATED_AT, UPDATED_AT,

View File

@ -41,7 +41,7 @@ class FloatingIP(neutron.NeutronResource):
entity = 'floatingip'
PROPERTIES = (
FLOATING_NETWORK_ID, FLOATING_NETWORK, FLOATING_SUBNET,
FLOATING_NETWORK_ID, FLOATING_NETWORK, FLOATING_SUBNET,
VALUE_SPECS, PORT_ID, FIXED_IP_ADDRESS, FLOATING_IP_ADDRESS,
DNS_NAME, DNS_DOMAIN,
) = (

View File

@ -111,7 +111,7 @@ class QoSRule(neutron.NeutronResource):
support_status = support.SupportStatus(version='6.0.0')
PROPERTIES = (
POLICY, TENANT_ID,
POLICY, TENANT_ID,
) = (
'policy', 'tenant_id',
)

View File

@ -98,7 +98,7 @@ class BaseServer(stack_user.StackUser):
occ.update({'zaqar': {
'user_id': self._get_user_id(),
'password': self.password,
'auth_url': self.keystone().server_keystone_endpoint_url(
'auth_url': self.keystone().server_keystone_endpoint_url(
fallback_endpoint=self.context.auth_url),
'project_id': self.stack.stack_user_project_id,
'queue_id': queue_id,

View File

@ -106,7 +106,7 @@ class SignalResponder(stack_user.StackUser):
if self.password is None:
self.password = password_gen.generate_openstack_password()
self._create_user()
return {'auth_url': self.keystone().server_keystone_endpoint_url(
return {'auth_url': self.keystone().server_keystone_endpoint_url(
fallback_endpoint=self.keystone().v3_endpoint),
'username': self.physical_resource_name(),
'user_id': self._get_user_id(),

View File

@ -22,7 +22,7 @@ from heat.tests import utils
QOS_SPECS_TEMPLATE = {
'heat_template_version': '2015-10-15',
'description': 'Cinder QoS specs creation example',
'description': 'Cinder QoS specs creation example',
'resources': {
'my_qos_specs': {
'type': 'OS::Cinder::QoSSpecs',
@ -36,7 +36,7 @@ QOS_SPECS_TEMPLATE = {
QOS_ASSOCIATE_TEMPLATE = {
'heat_template_version': '2015-10-15',
'description': 'Cinder QoS specs association example',
'description': 'Cinder QoS specs association example',
'resources': {
'my_qos_associate': {
'type': 'OS::Cinder::QoSAssociation',

View File

@ -201,4 +201,4 @@ class FlowClassifierTest(common.HeatTestCase):
{
'name': 'name-updated',
'description': 'description-updated',
}, self.test_resource.resource_id)
}, self.test_resource.resource_id)

View File

@ -168,4 +168,4 @@ class PortChainTest(common.HeatTestCase):
'description': 'description-updated',
'port_pair_groups': ['port_pair_group_2'],
'flow_classifiers': ['flow_classifier2'],
}, self.test_resource.resource_id)
}, self.test_resource.resource_id)

View File

@ -27,8 +27,8 @@ sample_template = {
'properties': {
'name': 'test_port_pair',
'description': 'desc',
'ingress': '6af055d3-26f6-48dd-a597-7611d7e58d35',
'egress': '6af055d3-26f6-48dd-a597-7611d7e58d35',
'ingress': '6af055d3-26f6-48dd-a597-7611d7e58d35',
'egress': '6af055d3-26f6-48dd-a597-7611d7e58d35',
'service_function_parameters': {'correlation': None}
}
}
@ -155,4 +155,4 @@ class PortPairTest(common.HeatTestCase):
{
'name': 'name-updated',
'description': 'description-updated',
}, self.test_resource.resource_id)
}, self.test_resource.resource_id)

View File

@ -28,7 +28,7 @@ sample_template = {
'properties': {
'name': 'test_port_pair_group',
'description': 'desc',
'port_pairs': ['port1']
'port_pairs': ['port1']
}
}
}
@ -155,7 +155,7 @@ class PortPairGroupTest(common.HeatTestCase):
{
'name': 'name-updated',
'description': 'description-updated',
}, self.test_resource.resource_id)
}, self.test_resource.resource_id)
def test_resource_handle_update_port_pairs(self):
self.patchobject(self.test_client_plugin,
@ -181,4 +181,4 @@ class PortPairGroupTest(common.HeatTestCase):
'name': 'name',
'description': 'description',
'port_pairs': ['port2'],
}, self.test_resource.resource_id)
}, self.test_resource.resource_id)

View File

@ -27,8 +27,8 @@ sample_template = {
'properties': {
'name': 'test_tap_flow',
'description': 'desc',
'port': '6af055d3-26f6-48dd-a597-7611d7e58d35',
'tap_service': '6af055d3-26f6-48dd-a597-7611d7e58d35',
'port': '6af055d3-26f6-48dd-a597-7611d7e58d35',
'tap_service': '6af055d3-26f6-48dd-a597-7611d7e58d35',
'direction': 'BOTH',
'vlan_filter': '1-5,9,18,27-30,99-108,4000-4095'
}
@ -177,4 +177,4 @@ class TapFlowTest(common.HeatTestCase):
'tap_service': '6af055d3-26f6-48dd-a597-7611d7e58d35',
'direction': 'BOTH',
'vlan_filter': '1-5,9,18,27-30,99-108,4000-4095',
}, self.test_resource.resource_id)
}, self.test_resource.resource_id)

View File

@ -27,7 +27,7 @@ sample_template = {
'properties': {
'name': 'test_tap_service',
'description': 'desc',
'port': '6af055d3-26f6-48dd-a597-7611d7e58d35',
'port': '6af055d3-26f6-48dd-a597-7611d7e58d35',
}
}
}
@ -149,4 +149,4 @@ class TapServiceTest(common.HeatTestCase):
'name': 'name-updated',
'description': 'description-updated',
'port': '6af055d3-26f6-48dd-a597-7611d7e58d35',
}, self.test_resource.resource_id)
}, self.test_resource.resource_id)

View File

@ -45,7 +45,7 @@ class FakeClient(fakes.FakeClient, Client):
class FakeSessionClient(base_client.SessionClient):
def __init__(self, *args, **kwargs):
def __init__(self, *args, **kwargs):
super(FakeSessionClient, self).__init__(*args, **kwargs)
self.callstack = []

View File

@ -21,7 +21,7 @@ from heat.tests import utils
AGGREGATE_TEMPLATE = {
'heat_template_version': '2013-05-23',
'description': 'Heat Aggregate creation example',
'description': 'Heat Aggregate creation example',
'resources': {
'my_aggregate': {
'type': 'OS::Nova::HostAggregate',

View File

@ -110,12 +110,9 @@ commands = bandit -r heat -x tests --skip B101,B104,B107,B110,B310,B311,B404,B41
show-source = true
# E123 closing bracket does not match indentation of opening bracket's line
# E226 missing whitespace around arithmetic operator
# E241 multiple spaces after ','
# E305 expected 2 blank lines after class or function definition, found 1
# E402 module level import not at top of file
# W503 line break before binary operator
# W504 line break after binary operator
ignore = E123,E226,E241,E402,W503,W504
ignore = E123,E226,W503,W504
exclude=.*,dist,*lib/python*,*egg,build,*convergence/scenarios/*
max-complexity=23