<commit_before>require 'colorize'

module Handlebars
  module Tree
    class TreeItem < Struct
      def eval(context)
        _eval(context)
      rescue Exception => exception
        puts "Unable to _evaluate #{self} with context #{context}".white

        line = "-" * 80
        raise exception.class, exception.message
      end
    end

    class TemplateContent < TreeItem.new(:content)
      def _eval(context)
        return content
      end
    end

    class Replacement < TreeItem.new(:item)
      def _eval(context)
        if context.get_helper(item.to_s).nil?
          context.get(item.to_s)
        else
          context.get_helper(item.to_s).apply(context)
        end
      end

      def is_else?
        item.to_s == 'else'
      end
    end

    class String < TreeItem.new(:content)
      def _eval(context)<commit_msg>Remove tracking of eval errors<commit_after>require 'colorize'

module Handlebars
  module Tree
    class TreeItem < Struct
      def eval(context)
        _eval(context)
      end
    end

    class TemplateContent < TreeItem.new(:content)
      def _eval(context)
        return content
      end
    end

    class Replacement < TreeItem.new(:item)
      def _eval(context)
        if context.get_helper(item.to_s).nil?
          context.get(item.to_s)
        else
          context.get_helper(item.to_s).apply(context)
        end
      end

      def is_else?
        item.to_s == 'else'
      end
    end

    class String < TreeItem.new(:content)
      def _eval(context)
{'fraction_non_alphanumeric': 0.08333333333333333, 'fraction_numerical': 0.0013123359580052493, 'mean_word_length': 2.0622489959839356, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 4, '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': '3683068', 'n_tokens_mistral': 461, 'n_tokens_neox': 449, 'n_words': 111}