<commit_before>module FindHelper
  def add_index_setting(_connection)
    {
      model_class => [
        [ :id, "PRIMARY" ],
        [ :age_and_status, "index_people_on_age_and_status" ],
      ],
      another_model_class => [
        [ :id, "PRIMARY" ]
      ]
    }.each do |model, settings|
      settings.each do |setting|
        index_key = _connection.add_index_setting model, *setting
        _connection.open_index model, index_key
      end
    end

    {
      model_class => [
        [ "PRIMARY", :write => true ]
      ],
      another_model_class => [
        [ "PRIMARY", :write => true ]
      ]
    }.each do |model, settings|
      settings.each do |setting|
        index_key = _connection.add_index_setting model, ActiveRecordHandlerSocket::Connection::WRITER_KEY, *setting
        _connection.open_index model, index_key, :write
      end
    end
  end

  def find_all(klass, conditions)
    if active_record_version >= Gem::Version.new("4.0.0")
      # XXX: not relation object
      klass.where(conditions).to_a
    else
      klass.all(:conditions => conditions)
    end
  end

  def active_record_version
    if ActiveRecord.respond_to?(:version)
      ActiveRecord.version
    else
      Gem::Version.new(ActiveRecord::VERSION::STRING)
    end
  end
end
<commit_msg>add {} for hash<commit_after>module FindHelper
  def add_index_setting(_connection)
    {
      model_class => [
        [ :id, "PRIMARY" ],
        [ :age_and_status, "index_people_on_age_and_status" ],
      ],
      another_model_class => [
        [ :id, "PRIMARY" ]
      ]
    }.each do |model, settings|
      settings.each do |setting|
        index_key = _connection.add_index_setting model, *setting
        _connection.open_index model, index_key
      end
    end

    {
      model_class => [
        [ "PRIMARY", { :write => true } ]
      ],
      another_model_class => [
        [ "PRIMARY", { :write => true } ]
      ]
    }.each do |model, settings|
      settings.each do |setting|
        index_key = _connection.add_index_setting model, ActiveRecordHandlerSocket::Connection::WRITER_KEY, *setting
        _connection.open_index model, index_key, :write
      end
    end
  end

  def find_all(klass, conditions)
    if active_record_version >= Gem::Version.new("4.0.0")
      # XXX: not relation object
      klass.where(conditions).to_a
    else
      klass.all(:conditions => conditions)
    end
  end

  def active_record_version
    if ActiveRecord.respond_to?(:version)
      ActiveRecord.version
    else
      Gem::Version.new(ActiveRecord::VERSION::STRING)
    end
  end
end

{'fraction_non_alphanumeric': 0.10760953112990007, 'fraction_numerical': 0.0023059185242121443, 'mean_word_length': 2.5175675675675677, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '2856139', 'n_tokens_mistral': 818, 'n_tokens_neox': 807, 'n_words': 164}