<commit_before>module ActiveRecord::Turntable
  module ActiveRecordExt
    # activerecord-import extension
    module ActiverecordImportExt
      extend ActiveSupport::Concern

      included do
        alias_method_chain :values_sql_for_columns_and_attributes, :turntable
      end

      private

        # @note override for sequencer injection
        # @see https://github.com/zdennis/activerecord-import/blob/ba909fed5a4785fe9c7cce89e48e1242bb6804ea/lib/activerecord-import/import.rb#L558-L581
        def values_sql_for_columns_and_attributes_with_turntable(columns, array_of_attributes)
          connection_memo = connection
          array_of_attributes.map do |arr|
            my_values = arr.each_with_index.map do |val, j|
              column = columns[j]

              # be sure to query sequence_name *last*, only if cheaper tests fail, because it's costly
              if val.nil? && column.name == primary_key && !sequence_name.blank?
                if sequencer_enabled?
                  connection_memo.next_sequence_value(sequence_name)
                else
                  connection_memo.next_value_for_sequence(sequence_name)
                end
              elsif column
                if respond_to?(:type_caster) && type_caster.respond_to?(:type_cast_for_database) # Rails 5.0 and higher
                  connection_memo.quote(type_caster.type_cast_for_database(column.name, val))
                else # Rails 4.2 and higher
                  connection_memo.quote(column.type_cast_from_user(val), column)
                end
              end
            end
            "(#{my_values.join(',')})"
          end
        end
    end

    begin
      require "activerecord-import"
      require "activerecord-import/base"
      (class << ActiveRecord::Base; self; end).include(ActiverecordImportExt)
    rescue LoadError
    end
  end
end<commit_msg>Remove alias_method_chain from ar-import extension<commit_after>module ActiveRecord::Turntable
  module ActiveRecordExt
    # activerecord-import extension
    module ActiverecordImportExt

      private

        # @note override for sequencer injection
        # @see https://github.com/zdennis/activerecord-import/blob/ba909fed5a4785fe9c7cce89e48e1242bb6804ea/lib/activerecord-import/import.rb#L558-L581
        def values_sql_for_columns_and_attributes(columns, array_of_attributes)
          connection_memo = connection
          array_of_attributes.map do |arr|
            my_values = arr.each_with_index.map do |val, j|
              column = columns[j]

              # be sure to query sequence_name *last*, only if cheaper tests fail, because it's costly
              if val.nil? && column.name == primary_key && !sequence_name.blank?
                if sequencer_enabled?
                  connection_memo.next_sequence_value(sequence_name)
                else
                  connection_memo.next_value_for_sequence(sequence_name)
                end
              elsif column
                if respond_to?(:type_caster) && type_caster.respond_to?(:type_cast_for_database) # Rails 5.0 and higher
                  connection_memo.quote(type_caster.type_cast_for_database(column.name, val))
                else # Rails 4.2 and higher
                  connection_memo.quote(column.type_cast_from_user(val), column)
                end
              end
            end
            "(#{my_values.join(',')})"
          end
        end
    end

    begin
      require "activerecord-import"
      require "activerecord-import/base"
      (class << ActiveRecord::Base; self; end).prepend(ActiverecordImportExt)
    rescue LoadError
    end
  end
end
{'fraction_non_alphanumeric': 0.07230895645028759, 'fraction_numerical': 0.017529443987948506, 'mean_word_length': 2.2812219227313566, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3836917', 'n_tokens_mistral': 1105, 'n_tokens_neox': 998, 'n_words': 201}