More flake8.

This commit is contained in:
Steve Pulec 2014-11-15 09:53:45 -05:00
parent 8ba308bf07
commit c77207a8b8
8 changed files with 20 additions and 22 deletions

View File

@ -360,4 +360,3 @@ for region, ec2_backend in ec2_backends.items():
autoscaling_backend = autoscaling_backends['us-east-1']
default_autoscaling_backend = autoscaling_backend

View File

@ -3,7 +3,6 @@ from boto.exception import BotoServerError
from jinja2 import Template
class UnformattedGetAttTemplateException(Exception):
description = 'Template error: resource {0} does not support attribute type {1} in Fn::GetAtt'
status_code = 400

View File

@ -129,9 +129,9 @@ def parse_resource(logical_id, resource_json, resources_map):
resource_json = clean_json(resource_json, resources_map)
resource_name_property = resource_name_property_from_type(resource_type)
if resource_name_property:
if not 'Properties' in resource_json:
if 'Properties' not in resource_json:
resource_json['Properties'] = dict()
if not resource_name_property in resource_json['Properties']:
if resource_name_property not in resource_json['Properties']:
resource_json['Properties'][resource_name_property] = '{0}-{1}-{2}'.format(
resources_map.get('AWS::StackName'),
logical_id,
@ -214,7 +214,7 @@ class ResourceMap(collections.Mapping):
self[resource]
if isinstance(self[resource], ec2_models.TaggedEC2Resource):
tags['aws:cloudformation:logical-id'] = resource
ec2_models.ec2_backend.create_tags([self[resource].physical_resource_id],tags)
ec2_models.ec2_backend.create_tags([self[resource].physical_resource_id], tags)
class OutputMap(collections.Mapping):

View File

@ -23,10 +23,10 @@ class RouteTables(BaseResponse):
pcx_id = optional_from_querystring('VpcPeeringConnectionId', self.querystring)
self.ec2_backend.create_route(route_table_id, destination_cidr_block,
gateway_id=internet_gateway_id,
instance_id=instance_id,
interface_id=interface_id,
vpc_peering_connection_id=pcx_id)
gateway_id=internet_gateway_id,
instance_id=instance_id,
interface_id=interface_id,
vpc_peering_connection_id=pcx_id)
template = Template(CREATE_ROUTE_RESPONSE)
return template.render()
@ -73,10 +73,10 @@ class RouteTables(BaseResponse):
pcx_id = optional_from_querystring('VpcPeeringConnectionId', self.querystring)
self.ec2_backend.replace_route(route_table_id, destination_cidr_block,
gateway_id=internet_gateway_id,
instance_id=instance_id,
interface_id=interface_id,
vpc_peering_connection_id=pcx_id)
gateway_id=internet_gateway_id,
instance_id=instance_id,
interface_id=interface_id,
vpc_peering_connection_id=pcx_id)
template = Template(REPLACE_ROUTE_RESPONSE)
return template.render()

View File

@ -390,8 +390,8 @@ def generic_filter(filters, objects):
def simple_aws_filter_to_re(filter_string):
import fnmatch
tmp_filter = filter_string.replace('\?','[?]')
tmp_filter = tmp_filter.replace('\*','[*]')
tmp_filter = filter_string.replace('\?', '[?]')
tmp_filter = tmp_filter.replace('\*', '[*]')
tmp_filter = fnmatch.translate(tmp_filter)
return tmp_filter
@ -425,7 +425,7 @@ def get_prefix(resource_id):
if resource_id_prefix == EC2_RESOURCE_TO_PREFIX['network-interface']:
if after.startswith('attach'):
resource_id_prefix = EC2_RESOURCE_TO_PREFIX['network-interface-attachment']
if not resource_id_prefix in EC2_RESOURCE_TO_PREFIX.values():
if resource_id_prefix not in EC2_RESOURCE_TO_PREFIX.values():
uuid4hex = re.compile('[0-9a-f]{12}4[0-9a-f]{3}[89ab][0-9a-f]{15}\Z', re.I)
if uuid4hex.match(resource_id) is not None:
resource_id_prefix = EC2_RESOURCE_TO_PREFIX['reserved-instance']
@ -437,7 +437,7 @@ def get_prefix(resource_id):
def is_valid_resource_id(resource_id):
valid_prefixes = EC2_RESOURCE_TO_PREFIX.values()
resource_id_prefix = get_prefix(resource_id)
if not resource_id_prefix in valid_prefixes:
if resource_id_prefix not in valid_prefixes:
return False
resource_id_pattern = resource_id_prefix + '-[0-9a-f]{8}'
resource_pattern_re = re.compile(resource_id_pattern)

View File

@ -272,7 +272,7 @@ class IAMBackend(BaseBackend):
return user
def create_login_profile(self, user_name, password):
if not user_name in self.users:
if user_name not in self.users:
raise BotoServerError(404, 'Not Found')
# This does not currently deal with PasswordPolicyViolation.

View File

@ -12,7 +12,7 @@ class ReceiptHandleIsInvalid(Exception):
class MessageAttributesInvalid(Exception):
status_code = 400
status_code = 400
def __init__(self, description):
self.description = description
def __init__(self, description):
self.description = description

View File

@ -52,7 +52,7 @@ def parse_message_attributes(querystring, base='', value_namespace='Value.'):
if not value:
raise MessageAttributesInvalid("The message attribute '{0}' must contain non-empty message attribute value for message attribute type '{1}'.".format(name[0], data_type[0]))
message_attributes[name[0]] = {'data_type' : data_type[0], type_prefix.lower() + '_value' : value[0]}
message_attributes[name[0]] = {'data_type': data_type[0], type_prefix.lower() + '_value': value[0]}
index += 1