<commit_before>require 'forwardable'

module Twigg
  class PairMatrix
    extend Forwardable
    def_delegators :pairs, :[], :keys

    def initialize(commit_set)
      @commit_set = commit_set
    end

    def pairs
      @pairs ||= begin
        Hash.new do |hash, pairer|
          hash[pairer] = Hash.new { |hash, pairee| hash[pairee] = 0 }
        end.tap do |matrix|
          @commit_set.each do |commit|
            authors = commit.author_names

            # if you're solo, that's equivalent to pairing with yourself
            authors *= 2 if authors.size == 1

            authors.permutation(2).each do |pairer, pairee|
              matrix[pairer][pairee] += 1
            end
          end
        end
      end
    end

    def authors
      @authors ||= pairs.keys.sort
    end

    def max_solo<commit_msg>Get rid of unnecessary `begin`/`end` in PairMatrix#pairs<commit_after>require 'forwardable'

module Twigg
  class PairMatrix
    extend Forwardable
    def_delegators :pairs, :[], :keys

    def initialize(commit_set)
      @commit_set = commit_set
    end

    def pairs
      @pairs ||= Hash.new do |hash, pairer|
        hash[pairer] = Hash.new { |hash, pairee| hash[pairee] = 0 }
      end.tap do |matrix|
        @commit_set.each do |commit|
          authors = commit.author_names

          # if you're solo, that's equivalent to pairing with yourself
          authors *= 2 if authors.size == 1

          authors.permutation(2).each do |pairer, pairee|
            matrix[pairer][pairee] += 1
          end
        end
      end
    end

    def authors
      @authors ||= pairs.keys.sort
    end

    def max_solo
{'fraction_non_alphanumeric': 0.09217707701637357, 'fraction_numerical': 0.006064281382656155, 'mean_word_length': 2.010948905109489, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7125744', 'n_tokens_mistral': 536, 'n_tokens_neox': 512, 'n_words': 143}