labpack/platforms/aws/ec2.py
def list_keypairs(self):

        '''
            a method to discover the list of key pairs on AWS

        :return: list of key pairs
        '''

        title = '%s.list_keypairs' % self.__class__.__name__

    # request subnet list from AWS
        self.iam.printer('Querying AWS region %s for key pairs.' % self.iam.region_name)
        keypair_list = []
        try:
            response = self.connection.describe_key_pairs()
        except:
            raise AWSConnectionError(title)
        response_list = []
        if 'KeyPairs' in response:
            response_list = response['KeyPairs']

    # construct list of keypairs from response
        for sub_dict in response_list:
            keypair_list.append(sub_dict['KeyName'])

    # report results and return list
        if keypair_list:
            print_out = 'Found key pair'
            if len(keypair_list) > 1:
                print_out += 's'
            from labpack.parsing.grammar import join_words
            print_out += ' %s.' % join_words(keypair_list)
            self.iam.printer(print_out)
        else:
            self.iam.printer('No key pairs found.')

        return keypair_list

            a method to discover the list of key pairs on AWS

        :return: list of key pairs
        
a method to discover the list of key pairs on AWS
a method to discover the list of key pairs on AWS
def list_keypairs(self):
        title = '%s.list_keypairs' % self.__class__.__name__
        self.iam.printer('Querying AWS region %s for key pairs.' % self.iam.region_name)
        keypair_list = []
        try:
            response = self.connection.describe_key_pairs()
        except:
            raise AWSConnectionError(title)
        response_list = []
        if 'KeyPairs' in response:
            response_list = response['KeyPairs']
        for sub_dict in response_list:
            keypair_list.append(sub_dict['KeyName'])
        if keypair_list:
            print_out = 'Found key pair'
            if len(keypair_list) > 1:
                print_out += 's'
            from labpack.parsing.grammar import join_words
            print_out += ' %s.' % join_words(keypair_list)
            self.iam.printer(print_out)
        else:
            self.iam.printer('No key pairs found.')
        return keypair_list
def list_keypairs ( self ) : title = '%s.list_keypairs' % self . __class__ . __name__ self . iam . printer ( 'Querying AWS region %s for key pairs.' % self . iam . region_name ) keypair_list = [ ] try : response = self . connection . describe_key_pairs ( ) except : raise AWSConnectionError ( title ) response_list = [ ] if 'KeyPairs' in response : response_list = response [ 'KeyPairs' ] for sub_dict in response_list : keypair_list . append ( sub_dict [ 'KeyName' ] ) if keypair_list : print_out = 'Found key pair' if len ( keypair_list ) > 1 : print_out += 's' from labpack . parsing . grammar import join_words print_out += ' %s.' % join_words ( keypair_list ) self . iam . printer ( print_out ) else : self . iam . printer ( 'No key pairs found.' ) return keypair_list
a method to discover the list of key pairs on AWS
a method to discover the list of key pairs on AWS
'''
            a method to discover the list of key pairs on AWS

        :return: list of key pairs
        ''' # request subnet list from AWS # construct list of keypairs from response # report results and return list
list of key pairs
list of key pairs
self