<commit_before>require 'net/http'
require 'net/https'
require 'logger'

require 'corn/report'
require 'corn/test_unit'
require 'corn/mini_test'

module Corn
  module_function

  def host
    ENV['CORN_HOST']
  end

  def client_id
    ENV['CORN_CLIENT_ID'] || 'corn client id'
  end

  def build_id
    ENV['CORN_BUILD_ID'] || 'corn build id'
  end

  def logger
    @logger ||= Logger.new(STDOUT)
  end

  def setup
    if RUBY_VERSION =~ /^1.8/
      Test::Unit::TestCase.send(:include, TestUnit18)
    else
      ::MiniTest::Unit::TestCase.send(:include, Corn::MiniTest)
    end
  end

  def report(test_name, &block)
    rep = report_start
    begin
      yield(rep)
    ensure
      report_end(test_name, rep)
    end
  end
<commit_msg>only install hook when the test framework exists in memory<commit_after>require 'net/http'
require 'net/https'
require 'logger'

require 'corn/report'
require 'corn/test_unit'
require 'corn/mini_test'

module Corn
  module_function

  def host
    ENV['CORN_HOST']
  end

  def client_id
    ENV['CORN_CLIENT_ID'] || 'corn client id'
  end

  def build_id
    ENV['CORN_BUILD_ID'] || 'corn build id'
  end

  def logger
    @logger ||= Logger.new(STDOUT)
  end

  def setup
    if RUBY_VERSION =~ /^1.8/
      if defined?(Test::Unit::TestCase)
        Test::Unit::TestCase.send(:include, TestUnit18)
      end
    end
    if defined?(::MiniTest::Unit::TestCase)
      ::MiniTest::Unit::TestCase.send(:include, Corn::MiniTest)
    end
  end

  def report(test_name, &block)
    rep = report_start
    begin
      yield(rep)
    ensure
      report_end(test_name, rep)
    end
  end

{'fraction_non_alphanumeric': 0.11467324290998766, 'fraction_numerical': 0.004932182490752158, 'mean_word_length': 3.1297709923664123, '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': '5027356', 'n_tokens_mistral': 608, 'n_tokens_neox': 569, 'n_words': 138}