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'] autoscaling_backend = autoscaling_backends['us-east-1']
default_autoscaling_backend = autoscaling_backend default_autoscaling_backend = autoscaling_backend

View File

@ -3,7 +3,6 @@ from boto.exception import BotoServerError
from jinja2 import Template from jinja2 import Template
class UnformattedGetAttTemplateException(Exception): class UnformattedGetAttTemplateException(Exception):
description = 'Template error: resource {0} does not support attribute type {1} in Fn::GetAtt' description = 'Template error: resource {0} does not support attribute type {1} in Fn::GetAtt'
status_code = 400 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_json = clean_json(resource_json, resources_map)
resource_name_property = resource_name_property_from_type(resource_type) resource_name_property = resource_name_property_from_type(resource_type)
if resource_name_property: if resource_name_property:
if not 'Properties' in resource_json: if 'Properties' not in resource_json:
resource_json['Properties'] = dict() 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( resource_json['Properties'][resource_name_property] = '{0}-{1}-{2}'.format(
resources_map.get('AWS::StackName'), resources_map.get('AWS::StackName'),
logical_id, logical_id,

View File

@ -425,7 +425,7 @@ def get_prefix(resource_id):
if resource_id_prefix == EC2_RESOURCE_TO_PREFIX['network-interface']: if resource_id_prefix == EC2_RESOURCE_TO_PREFIX['network-interface']:
if after.startswith('attach'): if after.startswith('attach'):
resource_id_prefix = EC2_RESOURCE_TO_PREFIX['network-interface-attachment'] 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) 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: if uuid4hex.match(resource_id) is not None:
resource_id_prefix = EC2_RESOURCE_TO_PREFIX['reserved-instance'] 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): def is_valid_resource_id(resource_id):
valid_prefixes = EC2_RESOURCE_TO_PREFIX.values() valid_prefixes = EC2_RESOURCE_TO_PREFIX.values()
resource_id_prefix = get_prefix(resource_id) 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 return False
resource_id_pattern = resource_id_prefix + '-[0-9a-f]{8}' resource_id_pattern = resource_id_prefix + '-[0-9a-f]{8}'
resource_pattern_re = re.compile(resource_id_pattern) resource_pattern_re = re.compile(resource_id_pattern)

View File

@ -272,7 +272,7 @@ class IAMBackend(BaseBackend):
return user return user
def create_login_profile(self, user_name, password): 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') raise BotoServerError(404, 'Not Found')
# This does not currently deal with PasswordPolicyViolation. # This does not currently deal with PasswordPolicyViolation.