<commit_before>module Enumerable
  def quicksort
    return self if size <= 1
    ary = dup
    pivot = ary.shift
    left, right = ary.partition { |n| n < pivot }
    left.quicksort + [pivot] + right.quicksort
  end

  def quicksort!
    replace(quicksort)
  end

  def insertion_sort
    self.dup.insertion_sort!
  end

  def insertion_sort!
    self.each_index do |i|
      j = i
      while j > 0 && self[j - 1] > self[j]
        self[j - 1], self[j] = self[j], self[j - 1]
        j -= 1
      end
    end
  end

  def merge_sort
    return self if self.size <= 1
    m = self.size / 2
    merge(self[0...m].merge_sort, self[m..-1].merge_sort)
  end

  def merge_sort!
    self.replace(self.merge_sort)
  end

  def merge(left, right)
    ary = []
    until left.empty? || right.empty?
      if left.first <= right.first
        ary << left.shift
      else
        ary << right.shift
      end
    end
    ary + left + right
  end

  private :merge

  def bogosort
    self.dup.bogosort!
  end

  def bogosort!
    self.shuffle! until each_cons(2).all? { |a, b| a <= b }
    self
  end
end<commit_msg>Remove reference to self where redundant<commit_after>module Enumerable
  def quicksort
    return self if size <= 1
    ary = dup
    pivot = ary.shift
    left, right = ary.partition { |n| n < pivot }
    left.quicksort + [pivot] + right.quicksort
  end

  def quicksort!
    replace(quicksort)
  end

  def insertion_sort
    dup.insertion_sort!
  end

  def insertion_sort!
    each_index do |i|
      j = i
      while j > 0 && self[j - 1] > self[j]
        self[j - 1], self[j] = self[j], self[j - 1]
        j -= 1
      end
    end
  end

  def merge_sort
    return self if size <= 1
    m = size / 2
    merge(self[0...m].merge_sort, self[m..-1].merge_sort)
  end

  def merge_sort!
    replace(merge_sort)
  end

  def merge(left, right)
    ary = []
    until left.empty? || right.empty?
      if left.first <= right.first
        ary << left.shift
      else
        ary << right.shift
      end
    end
    ary + left + right
  end

  private :merge

  def bogosort
    dup.bogosort!
  end

  def bogosort!
    shuffle! until each_cons(2).all? { |a, b| a <= b }
    self
  end
end
{'fraction_non_alphanumeric': 0.10995002271694684, 'fraction_numerical': 0.009995456610631531, 'mean_word_length': 1.9756756756756757, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 7, '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': '1291418', 'n_tokens_mistral': 848, 'n_tokens_neox': 797, 'n_words': 226}