Enable F402 and F812 style checks
Checks for shadowing by loop variables Change-Id: I6fd89d34fee35d08b5b15f2ee0015f1ed685f0be
This commit is contained in:
parent
8415baf6cc
commit
fb4f131d84
|
@ -504,8 +504,8 @@ class Instance(resource.Resource):
|
||||||
unsorted_nics.append(nic)
|
unsorted_nics.append(nic)
|
||||||
sorted_nics = sorted(unsorted_nics,
|
sorted_nics = sorted(unsorted_nics,
|
||||||
key=lambda nic: int(nic['DeviceIndex']))
|
key=lambda nic: int(nic['DeviceIndex']))
|
||||||
nics = [{'port-id': nic['NetworkInterfaceId']}
|
nics = [{'port-id': snic['NetworkInterfaceId']}
|
||||||
for nic in sorted_nics]
|
for snic in sorted_nics]
|
||||||
else:
|
else:
|
||||||
# if SubnetId property in Instance, ensure subnet exists
|
# if SubnetId property in Instance, ensure subnet exists
|
||||||
if subnet_id:
|
if subnet_id:
|
||||||
|
|
|
@ -100,11 +100,11 @@ class VPCGatewayAttachment(resource.Resource):
|
||||||
default_client_name = 'neutron'
|
default_client_name = 'neutron'
|
||||||
|
|
||||||
def _vpc_route_tables(self):
|
def _vpc_route_tables(self):
|
||||||
for resource in self.stack.itervalues():
|
for res in self.stack.itervalues():
|
||||||
if (resource.has_interface('AWS::EC2::RouteTable') and
|
if (res.has_interface('AWS::EC2::RouteTable') and
|
||||||
resource.properties.get(route_table.RouteTable.VPC_ID) ==
|
res.properties.get(route_table.RouteTable.VPC_ID) ==
|
||||||
self.properties.get(self.VPC_ID)):
|
self.properties.get(self.VPC_ID)):
|
||||||
yield resource
|
yield res
|
||||||
|
|
||||||
def add_dependencies(self, deps):
|
def add_dependencies(self, deps):
|
||||||
super(VPCGatewayAttachment, self).add_dependencies(deps)
|
super(VPCGatewayAttachment, self).add_dependencies(deps)
|
||||||
|
@ -112,8 +112,8 @@ class VPCGatewayAttachment(resource.Resource):
|
||||||
# VpcId as this VpcId.
|
# VpcId as this VpcId.
|
||||||
# All route tables must exist before gateway attachment
|
# All route tables must exist before gateway attachment
|
||||||
# as attachment happens to routers (not VPCs)
|
# as attachment happens to routers (not VPCs)
|
||||||
for route_table in self._vpc_route_tables():
|
for route_tbl in self._vpc_route_tables():
|
||||||
deps += (self, route_table)
|
deps += (self, route_tbl)
|
||||||
|
|
||||||
def handle_create(self):
|
def handle_create(self):
|
||||||
client = self.neutron()
|
client = self.neutron()
|
||||||
|
|
|
@ -180,7 +180,7 @@ class RandomString(resource.Resource):
|
||||||
for char_seq in char_sequences:
|
for char_seq in char_sequences:
|
||||||
seq = char_seq[self.CHARACTER_SEQUENCES_SEQUENCE]
|
seq = char_seq[self.CHARACTER_SEQUENCES_SEQUENCE]
|
||||||
seq_min = char_seq[self.CHARACTER_SEQUENCES_MIN]
|
seq_min = char_seq[self.CHARACTER_SEQUENCES_MIN]
|
||||||
for _ in xrange(seq_min):
|
for i in xrange(seq_min):
|
||||||
random_string += random.choice(seq)
|
random_string += random.choice(seq)
|
||||||
|
|
||||||
if char_classes:
|
if char_classes:
|
||||||
|
@ -188,7 +188,7 @@ class RandomString(resource.Resource):
|
||||||
cclass_class = char_class[self.CHARACTER_CLASSES_CLASS]
|
cclass_class = char_class[self.CHARACTER_CLASSES_CLASS]
|
||||||
cclass_seq = self._sequences[cclass_class]
|
cclass_seq = self._sequences[cclass_class]
|
||||||
cclass_min = char_class[self.CHARACTER_CLASSES_MIN]
|
cclass_min = char_class[self.CHARACTER_CLASSES_MIN]
|
||||||
for _ in xrange(cclass_min):
|
for i in xrange(cclass_min):
|
||||||
random_string += random.choice(cclass_seq)
|
random_string += random.choice(cclass_seq)
|
||||||
|
|
||||||
def random_class_char():
|
def random_class_char():
|
||||||
|
|
|
@ -292,9 +292,9 @@ class AccessPolicy(resource.Resource):
|
||||||
|
|
||||||
resources = self.properties[self.ALLOWED_RESOURCES]
|
resources = self.properties[self.ALLOWED_RESOURCES]
|
||||||
# All of the provided resource names must exist in this stack
|
# All of the provided resource names must exist in this stack
|
||||||
for resource in resources:
|
for res in resources:
|
||||||
if resource not in self.stack:
|
if res not in self.stack:
|
||||||
msg = _("AccessPolicy resource %s not in stack") % resource
|
msg = _("AccessPolicy resource %s not in stack") % res
|
||||||
raise exception.StackValidationFailed(message=msg)
|
raise exception.StackValidationFailed(message=msg)
|
||||||
|
|
||||||
def access_allowed(self, resource_name):
|
def access_allowed(self, resource_name):
|
||||||
|
|
|
@ -244,8 +244,8 @@ class Stack(collections.Mapping):
|
||||||
def _get_dependencies(resources):
|
def _get_dependencies(resources):
|
||||||
'''Return the dependency graph for a list of resources.'''
|
'''Return the dependency graph for a list of resources.'''
|
||||||
deps = dependencies.Dependencies()
|
deps = dependencies.Dependencies()
|
||||||
for resource in resources:
|
for res in resources:
|
||||||
resource.add_dependencies(deps)
|
res.add_dependencies(deps)
|
||||||
|
|
||||||
return deps
|
return deps
|
||||||
|
|
||||||
|
|
|
@ -704,7 +704,7 @@ class WaitConditionUpdateTest(common.HeatTestCase):
|
||||||
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
|
self.assertEqual((rsrc.CREATE, rsrc.COMPLETE), rsrc.state)
|
||||||
|
|
||||||
def _handle_signal(self, rsrc, metadata, times=1):
|
def _handle_signal(self, rsrc, metadata, times=1):
|
||||||
for time in range(times):
|
for t in range(times):
|
||||||
metadata['UniqueId'] = metadata['UniqueId'] * 2
|
metadata['UniqueId'] = metadata['UniqueId'] * 2
|
||||||
ret = rsrc.handle_signal(metadata)
|
ret = rsrc.handle_signal(metadata)
|
||||||
self.assertEqual("status:%s reason:%s" %
|
self.assertEqual("status:%s reason:%s" %
|
||||||
|
|
4
tox.ini
4
tox.ini
|
@ -54,8 +54,6 @@ commands =
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
# E251 unexpected spaces around keyword / parameter equals
|
# E251 unexpected spaces around keyword / parameter equals
|
||||||
# F402 import shadowed by loop variable
|
|
||||||
# F812 list comprehension redefines variable
|
|
||||||
# H202 assertRaises Exception too broad
|
# H202 assertRaises Exception too broad
|
||||||
# H233 Python 3.x incompatible use of print operator
|
# H233 Python 3.x incompatible use of print operator
|
||||||
# H305 imports not grouped correctly
|
# H305 imports not grouped correctly
|
||||||
|
@ -65,7 +63,7 @@ commands =
|
||||||
# H405 multi line docstring summary not separated with an empty line
|
# H405 multi line docstring summary not separated with an empty line
|
||||||
# H803 no full stop at the end of the commit message
|
# H803 no full stop at the end of the commit message
|
||||||
# H904 Wrap long lines in parentheses instead of a backslash
|
# H904 Wrap long lines in parentheses instead of a backslash
|
||||||
ignore = E251,F402,F812,H202,H233,H305,H307,H402,H404,H405,H803,H904
|
ignore = E251,H202,H233,H305,H307,H402,H404,H405,H803,H904
|
||||||
show-source = true
|
show-source = true
|
||||||
exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,tools,build
|
exclude=.venv,.git,.tox,dist,*openstack/common*,*lib/python*,*egg,tools,build
|
||||||
max-complexity=20
|
max-complexity=20
|
||||||
|
|
Loading…
Reference in New Issue