<commit_before>module Fog
  module AWS
    class EC2

      class Server < Fog::Model

        identity  :id,                'instanceId'

        attribute :architecture
        attribute :ami_launch_index,      'amiLaunchIndex'
        attribute :availability_zone,     'availabilityZone'
        attribute :block_device_mapping,  'blockDeviceMapping'
        attribute :dns_name,              'dnsName'
        attribute :groups
        attribute :flavor_id,             'instanceType'
        attribute :image_id,              'imageId'
        attribute :ip_address,            'ipAddress'
        attribute :kernel_id,             'kernelId'
        attribute :key_name,              'keyName'
        attribute :created_at,            'launchTime'
        attribute :monitoring
        attribute :product_codes,         'productCodes'
        attribute :private_dns_name,      'privateDnsName'
        attribute :private_ip_address,    'privateIpAddress'
        attribute :ramdisk_id,            'ramdiskId'
        attribute :reason
        attribute :root_device_name,      'rootDeviceName'
        attribute :root_device_type,      'rootDeviceType'
        attribute :state,                 'instanceState'
        attribute :user_data

        def initialize(attributes)
          @groups ||= ["default"]
          super
        end

        def addresses
          requires :id

          connection.addresses(:server => self)
        end

        def destroy
          requires :id

          connection.terminate_instances(@id)
          true
        end

        # def security_group
        #   connection.security_groups.all(@group_id)
        # end
        #
        # def security_group=(new_security_group)
        #   @group_id = new_security_group.name
        # end

        def flavor_id
          @flavor && @flavor.id || 'm1.small'
        end

        def flavor=(new_flavor)
          @flavor = new_flavor
        end

        def flavor
          @flavor || connection.flavors.all.detect {|flavor| flavor.id == @flavor_id}
        end

        def key_pair
          requires :key_name

          connection.keypairs.all(@key_name).first
        end<commit_msg>fix a bug where flavor_id would mistakenly be reset to m1.small<commit_after>module Fog
  module AWS
    class EC2

      class Server < Fog::Model

        identity  :id,                'instanceId'

        attribute :architecture
        attribute :ami_launch_index,      'amiLaunchIndex'
        attribute :availability_zone,     'availabilityZone'
        attribute :block_device_mapping,  'blockDeviceMapping'
        attribute :dns_name,              'dnsName'
        attribute :groups
        attribute :flavor_id,             'instanceType'
        attribute :image_id,              'imageId'
        attribute :ip_address,            'ipAddress'
        attribute :kernel_id,             'kernelId'
        attribute :key_name,              'keyName'
        attribute :created_at,            'launchTime'
        attribute :monitoring
        attribute :product_codes,         'productCodes'
        attribute :private_dns_name,      'privateDnsName'
        attribute :private_ip_address,    'privateIpAddress'
        attribute :ramdisk_id,            'ramdiskId'
        attribute :reason
        attribute :root_device_name,      'rootDeviceName'
        attribute :root_device_type,      'rootDeviceType'
        attribute :state,                 'instanceState'
        attribute :user_data

        def initialize(attributes)
          @groups ||= ["default"]
          super
        end

        def addresses
          requires :id

          connection.addresses(:server => self)
        end

        def destroy
          requires :id

          connection.terminate_instances(@id)
          true
        end

        # def security_group
        #   connection.security_groups.all(@group_id)
        # end
        #
        # def security_group=(new_security_group)
        #   @group_id = new_security_group.name
        # end

        def flavor_id
          @flavor_id || @flavor && @flavor.id || 'm1.small'
        end

        def flavor=(new_flavor)
          @flavor = new_flavor
        end

        def flavor
          @flavor || connection.flavors.all.detect {|flavor| flavor.id == @flavor_id}
        end

        def key_pair
          requires :key_name

          connection.keypairs.all(@key_name).first
        end
{'fraction_non_alphanumeric': 0.0724246513720198, 'fraction_numerical': 0.0011246063877642825, 'mean_word_length': 1.6821471652593487, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4206213', 'n_tokens_mistral': 1199, 'n_tokens_neox': 1157, 'n_words': 264}