<commit_before>class ManageIQ::Providers::Amazon::CloudManager::Vm < ManageIQ::Providers::CloudManager::Vm
  include_concern 'Operations'
  include_concern 'ManageIQ::Providers::Amazon::CloudManager::VmOrTemplateShared'

  POWER_STATES = {
    "running"       => "on",
    "powering_up"   => "powering_up",
    "shutting_down" => "powering_down",
    "shutting-down" => "powering_down",
    "stopping"      => "powering_down",
    "pending"       => "suspended",
    "terminated"    => "terminated",
    "stopped"       => "off",
    "off"           => "off",
    # 'unknown' will be set by #disconnect_ems - which means 'terminated' in our case
    "unknown"       => "terminated",
  }.freeze

  def provider_object(connection = nil)
    connection ||= ext_management_system.connect
    connection.instance(ems_ref)
  end

  def memory_mb_available?
    true
  end

  #
  # Relationship methods
  #

  def disconnect_inv
    super

    # Mark all instances no longer found as unknown
    self.raw_power_state = "unknown"
    save
  end

  #
  # EC2 interactions
  #

  def set_custom_field(key, value)
    with_provider_object do |instance|
      tags = instance.create_tags ({
        tags: [
                {
                  key: key,
                  value: value,
                },
              ],
      })
      tags.find{|tag| tag.key == key}.value == value
    end
  end

  def self.calculate_power_state(raw_power_state)
    # http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_InstanceState.html
    POWER_STATES[raw_power_state.to_s] || "terminated"
  end

  def self.display_name(number = 1)
    n_('Instance (Amazon)', 'Instances (Amazon)', number)
  end
end<commit_msg>Remove space that was causing a group expression warning.<commit_after>class ManageIQ::Providers::Amazon::CloudManager::Vm < ManageIQ::Providers::CloudManager::Vm
  include_concern 'Operations'
  include_concern 'ManageIQ::Providers::Amazon::CloudManager::VmOrTemplateShared'

  POWER_STATES = {
    "running"       => "on",
    "powering_up"   => "powering_up",
    "shutting_down" => "powering_down",
    "shutting-down" => "powering_down",
    "stopping"      => "powering_down",
    "pending"       => "suspended",
    "terminated"    => "terminated",
    "stopped"       => "off",
    "off"           => "off",
    # 'unknown' will be set by #disconnect_ems - which means 'terminated' in our case
    "unknown"       => "terminated",
  }.freeze

  def provider_object(connection = nil)
    connection ||= ext_management_system.connect
    connection.instance(ems_ref)
  end

  def memory_mb_available?
    true
  end

  #
  # Relationship methods
  #

  def disconnect_inv
    super

    # Mark all instances no longer found as unknown
    self.raw_power_state = "unknown"
    save
  end

  #
  # EC2 interactions
  #

  def set_custom_field(key, value)
    with_provider_object do |instance|
      tags = instance.create_tags({
        tags: [
                {
                  key: key,
                  value: value,
                },
              ],
      })
      tags.find{|tag| tag.key == key}.value == value
    end
  end

  def self.calculate_power_state(raw_power_state)
    # http://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_InstanceState.html
    POWER_STATES[raw_power_state.to_s] || "terminated"
  end

  def self.display_name(number = 1)
    n_('Instance (Amazon)', 'Instances (Amazon)', number)
  end
end
{'fraction_non_alphanumeric': 0.11965065502183406, 'fraction_numerical': 0.0017467248908296944, 'mean_word_length': 2.6748663101604278, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, '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': '3746515', 'n_tokens_mistral': 1145, 'n_tokens_neox': 1088, 'n_words': 219}