<commit_before>Dir[File.join(File.dirname(__FILE__), 'twig', '*.rb')].each { |file| require file }
require 'time'

# The main class.
class Twig
  include Cli
  include Display
  include Options

  attr_accessor :options

  DEFAULT_GITHUB_API_URI_PREFIX = 'https://api.github.com'
  DEFAULT_GITHUB_URI_PREFIX = 'https://github.com'
  DEFAULT_HEADER_COLOR = :blue
  REF_FORMAT_SEPARATOR = '|'
  REF_FORMAT = %w[refname:short committerdate committerdate:relative].
                map { |field| '%(' + field + ')' }.join(REF_FORMAT_SEPARATOR)
  REF_PREFIX = 'refs/heads/'

  def self.run(command)
    `#{command}`.strip
  end

  def self.repo?
    Twig.run('git rev-parse 2>&1')
    $?.success?
  end

  def initialize
    self.options = {}

    # Set defaults
    set_option(:github_api_uri_prefix, DEFAULT_GITHUB_API_URI_PREFIX)
    set_option(:github_uri_prefix, DEFAULT_GITHUB_URI_PREFIX)
    set_option(:header_style, DEFAULT_HEADER_COLOR.to_s)
  end

  def current_branch_name
    @_current_branch_name ||= Twig.run('git rev-parse --abbrev-ref HEAD')
  end

  def all_branches
    @_all_branches ||= begin
      branch_tuples = Twig.
        run(%{git for-each-ref #{ REF_PREFIX } --format="#{ REF_FORMAT }"}).
        split("\n")

      branch_tuples.inject([]) do |result, branch_tuple|
        ref, time_string, time_ago = branch_tuple.split(REF_FORMAT_SEPARATOR)
        time        = Time.parse(time_string)
        commit_time = Twig::CommitTime.new(time, time_ago)
        branch      = Branch.new(ref, :last_commit_time => commit_time)
        result << branch<commit_msg>Clarify variable name<commit_after>Dir[File.join(File.dirname(__FILE__), 'twig', '*.rb')].each { |file| require file }
require 'time'

# The main class.
class Twig
  include Cli
  include Display
  include Options

  attr_accessor :options

  DEFAULT_GITHUB_API_URI_PREFIX = 'https://api.github.com'
  DEFAULT_GITHUB_URI_PREFIX = 'https://github.com'
  DEFAULT_HEADER_COLOR = :blue
  REF_FORMAT_SEPARATOR = '|'
  REF_FORMAT = %w[refname:short committerdate committerdate:relative].
                map { |field| '%(' + field + ')' }.join(REF_FORMAT_SEPARATOR)
  REF_PREFIX = 'refs/heads/'

  def self.run(command)
    `#{command}`.strip
  end

  def self.repo?
    Twig.run('git rev-parse 2>&1')
    $?.success?
  end

  def initialize
    self.options = {}

    # Set defaults
    set_option(:github_api_uri_prefix, DEFAULT_GITHUB_API_URI_PREFIX)
    set_option(:github_uri_prefix, DEFAULT_GITHUB_URI_PREFIX)
    set_option(:header_style, DEFAULT_HEADER_COLOR.to_s)
  end

  def current_branch_name
    @_current_branch_name ||= Twig.run('git rev-parse --abbrev-ref HEAD')
  end

  def all_branches
    @_all_branches ||= begin
      branch_tuples = Twig.
        run(%{git for-each-ref #{ REF_PREFIX } --format="#{ REF_FORMAT }"}).
        split("\n")

      branch_tuples.inject([]) do |result, branch_tuple|
        name, time_string, time_ago = branch_tuple.split(REF_FORMAT_SEPARATOR)
        time        = Time.parse(time_string)
        commit_time = Twig::CommitTime.new(time, time_ago)
        branch      = Branch.new(name, :last_commit_time => commit_time)
        result << branch
{'fraction_non_alphanumeric': 0.12405541561712846, 'fraction_numerical': 0.0012594458438287153, 'mean_word_length': 3.4683544303797467, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 4, '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': '3159420', 'n_tokens_mistral': 1121, 'n_tokens_neox': 1086, 'n_words': 201}