<commit_before>module Fog
  module Parsers
    module Compute
      module AWS
        class DescribeReservedInstances < Fog::Parsers::Base
          def get_default_item
            {'tagSet' => {}, 'recurringCharges' => {}}
          end

          def reset
            @context = []
            # Note:  <recurringCharges> should also be handled as a set, but do not want to disrupt anyone relying on
            # it currently being flatted
            @contexts = ['reservedInstancesSet', 'tagSet']
            @reserved_instance = get_default_item
            @response = { 'reservedInstancesSet' => [] }
            @tag = {}
          end

          def start_element(name, attrs = [])
            super
            if @contexts.include?(name)
              @context.push(name)
            end
          end

          def end_element(name)
            case name
            when 'availabilityZone', 'instanceType', 'productDescription', 'reservedInstancesId', 'state', 'offeringType'
              @reserved_instance[name] = value
            when 'duration', 'instanceCount'
              @reserved_instance[name] = value.to_i
            when 'fixedPrice', 'amount', 'usagePrice'
              @reserved_instance[name] = value.to_f
            when *@contexts
              @context.pop
            when 'item'
              case @context.last<commit_msg>Adding instanceTenancy to reserved instance parser.<commit_after>module Fog
  module Parsers
    module Compute
      module AWS
        class DescribeReservedInstances < Fog::Parsers::Base
          def get_default_item
            {'tagSet' => {}, 'recurringCharges' => {}}
          end

          def reset
            @context = []
            # Note:  <recurringCharges> should also be handled as a set, but do not want to disrupt anyone relying on
            # it currently being flatted
            @contexts = ['reservedInstancesSet', 'tagSet']
            @reserved_instance = get_default_item
            @response = { 'reservedInstancesSet' => [] }
            @tag = {}
          end

          def start_element(name, attrs = [])
            super
            if @contexts.include?(name)
              @context.push(name)
            end
          end

          def end_element(name)
            case name
            when 'availabilityZone', 'instanceType', 'productDescription', 'reservedInstancesId', 'state', 'offeringType', 'instanceTenancy'
              @reserved_instance[name] = value
            when 'duration', 'instanceCount'
              @reserved_instance[name] = value.to_i
            when 'fixedPrice', 'amount', 'usagePrice'
              @reserved_instance[name] = value.to_f
            when *@contexts
              @context.pop
            when 'item'
              case @context.last
{'fraction_non_alphanumeric': 0.09243998566821927, 'fraction_numerical': 0.0, 'mean_word_length': 1.7698412698412698, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '675214', 'n_tokens_mistral': 732, 'n_tokens_neox': 710, 'n_words': 185}