<commit_before>class Test::Unit::TestCase
  class << self
    attr_accessor :before_each_callbacks, :before_all_callbacks, :after_each_callbacks, :after_all_callbacks

    # Add logic to run before the tests (i.e., a +setup+ method)
    #
    #     before do
    #       @user = User.first
    #     end
    # 
    def before(period = :each, &block)
      send("before_#{period}_callbacks") << block
    end
    
    # Add logic to run after the tests (i.e., a +teardown+ method)
    #
    #     after do
    #       User.delete_all
    #     end
    #
    def after(period = :each, &block)
      send("after_#{period}_callbacks") << block
    end
  end

  self.before_all_callbacks  = []
  self.before_each_callbacks = []
  self.after_each_callbacks  = []
  self.after_all_callbacks   = []

  def self.inherited(child)
    super
    child.before_all_callbacks  = before_all_callbacks.dup
    child.before_each_callbacks = before_each_callbacks.dup
    child.after_each_callbacks  = after_each_callbacks.dup
    child.after_all_callbacks   = after_all_callbacks.dup

    child.class_eval do
      def setup
        self.class.before_each_callbacks.each { |c| instance_eval(&c) }
      end

      def teardown
        self.class.after_each_callbacks.each { |c| instance_eval(&c) }
      end
    end
  end

  def run_all_callbacks(period = :before)
    previous_ivars = instance_variables
    self.class.send("#{period}_all_callbacks").each { |c| instance_eval(&c) }
    (instance_variables - previous_ivars).inject({}) do |hash, ivar|
      hash.update ivar => instance_variable_get(ivar)
    end
  end

  def set_values_from_callbacks(values)
    values.each do |name, value|
      instance_variable_set name, value
    end
  end

private
  def instance_variable_hash
    instance_variables.inject({}) { |hash, var| }
  end
end<commit_msg>remove unused/unfinished method<commit_after>class Test::Unit::TestCase
  class << self
    attr_accessor :before_each_callbacks, :before_all_callbacks, :after_each_callbacks, :after_all_callbacks

    # Add logic to run before the tests (i.e., a +setup+ method)
    #
    #     before do
    #       @user = User.first
    #     end
    # 
    def before(period = :each, &block)
      send("before_#{period}_callbacks") << block
    end
    
    # Add logic to run after the tests (i.e., a +teardown+ method)
    #
    #     after do
    #       User.delete_all
    #     end
    #
    def after(period = :each, &block)
      send("after_#{period}_callbacks") << block
    end
  end

  self.before_all_callbacks  = []
  self.before_each_callbacks = []
  self.after_each_callbacks  = []
  self.after_all_callbacks   = []

  def self.inherited(child)
    super
    child.before_all_callbacks  = before_all_callbacks.dup
    child.before_each_callbacks = before_each_callbacks.dup
    child.after_each_callbacks  = after_each_callbacks.dup
    child.after_all_callbacks   = after_all_callbacks.dup

    child.class_eval do
      def setup
        self.class.before_each_callbacks.each { |c| instance_eval(&c) }
      end

      def teardown
        self.class.after_each_callbacks.each { |c| instance_eval(&c) }
      end
    end
  end

  def run_all_callbacks(period = :before)
    previous_ivars = instance_variables
    self.class.send("#{period}_all_callbacks").each { |c| instance_eval(&c) }
    (instance_variables - previous_ivars).inject({}) do |hash, ivar|
      hash.update ivar => instance_variable_get(ivar)
    end
  end

  def set_values_from_callbacks(values)
    values.each do |name, value|
      instance_variable_set name, value
    end
  end
end
{'fraction_non_alphanumeric': 0.09911160466407551, 'fraction_numerical': 0.0, 'mean_word_length': 2.9463307776560788, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 5, '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': '6505501', 'n_tokens_mistral': 1215, 'n_tokens_neox': 1203, 'n_words': 240}