diff --git a/moto/autoscaling/models.py b/moto/autoscaling/models.py index 1e2cf689..bcd40e89 100644 --- a/moto/autoscaling/models.py +++ b/moto/autoscaling/models.py @@ -360,4 +360,3 @@ for region, ec2_backend in ec2_backends.items(): autoscaling_backend = autoscaling_backends['us-east-1'] default_autoscaling_backend = autoscaling_backend - diff --git a/moto/cloudformation/exceptions.py b/moto/cloudformation/exceptions.py index c8bb5b39..8fc7dce0 100644 --- a/moto/cloudformation/exceptions.py +++ b/moto/cloudformation/exceptions.py @@ -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 diff --git a/moto/cloudformation/parsing.py b/moto/cloudformation/parsing.py index 97c70796..dc07aa4e 100644 --- a/moto/cloudformation/parsing.py +++ b/moto/cloudformation/parsing.py @@ -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): diff --git a/moto/ec2/responses/route_tables.py b/moto/ec2/responses/route_tables.py index 010de62e..ae9abff4 100644 --- a/moto/ec2/responses/route_tables.py +++ b/moto/ec2/responses/route_tables.py @@ -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() diff --git a/moto/ec2/utils.py b/moto/ec2/utils.py index 3999c7e4..ee9c9143 100644 --- a/moto/ec2/utils.py +++ b/moto/ec2/utils.py @@ -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) diff --git a/moto/iam/models.py b/moto/iam/models.py index 84f3274c..7c4f2ec8 100644 --- a/moto/iam/models.py +++ b/moto/iam/models.py @@ -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. diff --git a/moto/sqs/exceptions.py b/moto/sqs/exceptions.py index 7ae661cc..d72cfdff 100644 --- a/moto/sqs/exceptions.py +++ b/moto/sqs/exceptions.py @@ -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 diff --git a/moto/sqs/utils.py b/moto/sqs/utils.py index 294611a0..8dee7003 100644 --- a/moto/sqs/utils.py +++ b/moto/sqs/utils.py @@ -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