pep8
This commit is contained in:
		
							parent
							
								
									bcbec29653
								
							
						
					
					
						commit
						d32059f301
					
				@ -20,7 +20,8 @@ class Table(object):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @property
 | 
					    @property
 | 
				
			||||||
    def describe(self):
 | 
					    def describe(self):
 | 
				
			||||||
        return {"Table": {
 | 
					        return {
 | 
				
			||||||
 | 
					            "Table": {
 | 
				
			||||||
                "CreationDateTime": unix_time(self.created_at),
 | 
					                "CreationDateTime": unix_time(self.created_at),
 | 
				
			||||||
                "KeySchema": {
 | 
					                "KeySchema": {
 | 
				
			||||||
                    "HashKeyElement": {
 | 
					                    "HashKeyElement": {
 | 
				
			||||||
 | 
				
			|||||||
@ -1,5 +1,6 @@
 | 
				
			|||||||
import datetime
 | 
					import datetime
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def unix_time(dt):
 | 
					def unix_time(dt):
 | 
				
			||||||
    epoch = datetime.datetime.utcfromtimestamp(0)
 | 
					    epoch = datetime.datetime.utcfromtimestamp(0)
 | 
				
			||||||
    delta = dt - epoch
 | 
					    delta = dt - epoch
 | 
				
			||||||
 | 
				
			|||||||
@ -132,6 +132,7 @@ class Ami(object):
 | 
				
			|||||||
        self.virtualization_type = instance.virtualization_type
 | 
					        self.virtualization_type = instance.virtualization_type
 | 
				
			||||||
        self.kernel_id = instance.kernel
 | 
					        self.kernel_id = instance.kernel
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class AmiBackend(object):
 | 
					class AmiBackend(object):
 | 
				
			||||||
    def __init__(self):
 | 
					    def __init__(self):
 | 
				
			||||||
        self.amis = {}
 | 
					        self.amis = {}
 | 
				
			||||||
@ -381,4 +382,3 @@ class EC2Backend(BaseBackend, InstanceBackend, TagBackend, AmiBackend, RegionsAn
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ec2_backend = EC2Backend()
 | 
					ec2_backend = EC2Backend()
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -32,7 +32,6 @@ from .vpn_connections import VPNConnections
 | 
				
			|||||||
from .windows import Windows
 | 
					from .windows import Windows
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
class EC2Response(object):
 | 
					class EC2Response(object):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    sub_responses = [
 | 
					    sub_responses = [
 | 
				
			||||||
 | 
				
			|||||||
@ -99,4 +99,3 @@ DEREGISTER_IMAGE_RESPONSE = """<DeregisterImageResponse xmlns="http://ec2.amazon
 | 
				
			|||||||
  <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
 | 
					  <requestId>59dbff89-35bd-4eac-99ed-be587EXAMPLE</requestId>
 | 
				
			||||||
  <return>{{ success }}</return>
 | 
					  <return>{{ success }}</return>
 | 
				
			||||||
</DeregisterImageResponse>"""
 | 
					</DeregisterImageResponse>"""
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -16,6 +16,7 @@ class FakeKey(object):
 | 
				
			|||||||
        value_md5.update(self.value)
 | 
					        value_md5.update(self.value)
 | 
				
			||||||
        return '"{0}"'.format(value_md5.hexdigest())
 | 
					        return '"{0}"'.format(value_md5.hexdigest())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class FakeBucket(object):
 | 
					class FakeBucket(object):
 | 
				
			||||||
    def __init__(self, name):
 | 
					    def __init__(self, name):
 | 
				
			||||||
        self.name = name
 | 
					        self.name = name
 | 
				
			||||||
@ -48,7 +49,6 @@ class S3Backend(BaseBackend):
 | 
				
			|||||||
                return self.buckets.pop(bucket_name)
 | 
					                return self.buckets.pop(bucket_name)
 | 
				
			||||||
        return None
 | 
					        return None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
    def set_key(self, bucket_name, key_name, value):
 | 
					    def set_key(self, bucket_name, key_name, value):
 | 
				
			||||||
        bucket = self.buckets[bucket_name]
 | 
					        bucket = self.buckets[bucket_name]
 | 
				
			||||||
        new_key = FakeKey(name=key_name, value=value)
 | 
					        new_key = FakeKey(name=key_name, value=value)
 | 
				
			||||||
 | 
				
			|||||||
@ -66,5 +66,4 @@ class SESBackend(BaseBackend):
 | 
				
			|||||||
    def get_send_quota(self):
 | 
					    def get_send_quota(self):
 | 
				
			||||||
        return SESQuota(self.sent_messages)
 | 
					        return SESQuota(self.sent_messages)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
ses_backend = SESBackend()
 | 
					ses_backend = SESBackend()
 | 
				
			||||||
@ -23,6 +23,7 @@ class Message(object):
 | 
				
			|||||||
        # SQS Message bodies are base64 encoded by default
 | 
					        # SQS Message bodies are base64 encoded by default
 | 
				
			||||||
        return base64.b64encode(self._body)
 | 
					        return base64.b64encode(self._body)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Queue(object):
 | 
					class Queue(object):
 | 
				
			||||||
    camelcase_attributes = ['VisibilityTimeout', 'ApproximateNumberOfMessages']
 | 
					    camelcase_attributes = ['VisibilityTimeout', 'ApproximateNumberOfMessages']
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -5,4 +5,4 @@ from moto import mock_ec2
 | 
				
			|||||||
@mock_ec2
 | 
					@mock_ec2
 | 
				
			||||||
def test_not_implemented_method():
 | 
					def test_not_implemented_method():
 | 
				
			||||||
    requests.post.when.called_with("https://ec2.us-east-1.amazonaws.com/",
 | 
					    requests.post.when.called_with("https://ec2.us-east-1.amazonaws.com/",
 | 
				
			||||||
        data={'Action':['foobar']}).should.throw(NotImplementedError)
 | 
					        data={'Action': ['foobar']}).should.throw(NotImplementedError)
 | 
				
			||||||
 | 
				
			|||||||
@ -10,7 +10,7 @@ def test_create_and_describe_security_group():
 | 
				
			|||||||
    conn = boto.connect_ec2('the_key', 'the_secret')
 | 
					    conn = boto.connect_ec2('the_key', 'the_secret')
 | 
				
			||||||
    security_group = conn.create_security_group('test security group', 'this is a test security group')
 | 
					    security_group = conn.create_security_group('test security group', 'this is a test security group')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    security_group.name.should.equal('test security group')
 | 
					    expect(security_group).name.should.equal('test security group')
 | 
				
			||||||
    security_group.description.should.equal('this is a test security group')
 | 
					    security_group.description.should.equal('this is a test security group')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Trying to create another group with the same name should throw an error
 | 
					    # Trying to create another group with the same name should throw an error
 | 
				
			||||||
@ -25,7 +25,7 @@ def test_create_and_describe_security_group():
 | 
				
			|||||||
def test_deleting_security_groups():
 | 
					def test_deleting_security_groups():
 | 
				
			||||||
    conn = boto.connect_ec2('the_key', 'the_secret')
 | 
					    conn = boto.connect_ec2('the_key', 'the_secret')
 | 
				
			||||||
    security_group1 = conn.create_security_group('test1', 'test1')
 | 
					    security_group1 = conn.create_security_group('test1', 'test1')
 | 
				
			||||||
    security_group2 = conn.create_security_group('test2', 'test2')
 | 
					    conn.create_security_group('test2', 'test2')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    conn.get_all_security_groups().should.have.length_of(2)
 | 
					    conn.get_all_security_groups().should.have.length_of(2)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -62,6 +62,7 @@ def test_authorize_ip_range_and_revoke():
 | 
				
			|||||||
    security_group = conn.get_all_security_groups()[0]
 | 
					    security_group = conn.get_all_security_groups()[0]
 | 
				
			||||||
    security_group.rules.should.have.length_of(0)
 | 
					    security_group.rules.should.have.length_of(0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@mock_ec2
 | 
					@mock_ec2
 | 
				
			||||||
def test_authorize_other_group_and_revoke():
 | 
					def test_authorize_other_group_and_revoke():
 | 
				
			||||||
    conn = boto.connect_ec2('the_key', 'the_secret')
 | 
					    conn = boto.connect_ec2('the_key', 'the_secret')
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user