<commit_before>module Rscons
  # Module to contain logic to write ANSI color escape codes.
  module Ansi
    class << self

      # Write a message to an IO with ANSI escape codes.
      #
      # @param io [IO]
      #   The IO to write to.
      # @param message [Array<String, Symbol>]
      #   Strings to be printed, with Symbols representing ANSI escape codes.
      #
      # @return [void]
      def write(io, *message)
        do_color = Rscons.application.do_ansi_color
        if do_color.nil?
          do_color = do_ansi?(io)
        end
        out = ""
        message.each do |m|
          if m.is_a?(String)
            out += m
          elsif do_color
            case m
            when :red
              out += "\e[0;31m"
            when :cyan
              out += "\e[0;36m"
            when :reset
              out += "\e[0m"
            end
          end
        end
        io.write(out)
      end

      private

      # Determine whether to output ANSI color escape codes.
      #
      # @return [Boolean]
      #   Whether to output ANSI color escape codes.
      def do_ansi?(io)
        if RUBY_PLATFORM =~ /mingw/
          (ENV["TERM"] == "xterm") && %w[fifo characterSpecial].include?(io.stat.ftype)
        else
          io.tty?
        end
      end

    end
  end
end
<commit_msg>Ansi: add some other colors<commit_after>module Rscons
  # Module to contain logic to write ANSI color escape codes.
  module Ansi
    class << self

      # Write a message to an IO with ANSI escape codes.
      #
      # @param io [IO]
      #   The IO to write to.
      # @param message [Array<String, Symbol>]
      #   Strings to be printed, with Symbols representing ANSI escape codes.
      #
      # @return [void]
      def write(io, *message)
        do_color = Rscons.application.do_ansi_color
        if do_color.nil?
          do_color = do_ansi?(io)
        end
        out = ""
        message.each do |m|
          if m.is_a?(String)
            out += m
          elsif do_color
            case m
            when :red
              out += "\e[0;31m"
            when :green
              out += "\e[0;32m"
            when :yellow
              out += "\e[0;33m"
            when :blue
              out += "\e[0;34m"
            when :magenta
              out += "\e[0;35m"
            when :cyan
              out += "\e[0;36m"
            when :white
              out += "\e[0;37m"
            when :reset
              out += "\e[0m"
            end
          end
        end
        io.write(out)
      end

      private

      # Determine whether to output ANSI color escape codes.
      #
      # @return [Boolean]
      #   Whether to output ANSI color escape codes.
      def do_ansi?(io)
        if RUBY_PLATFORM =~ /mingw/
          (ENV["TERM"] == "xterm") && %w[fifo characterSpecial].include?(io.stat.ftype)
        else
          io.tty?
        end
      end

    end
  end
end

{'fraction_non_alphanumeric': 0.09632402995234854, 'fraction_numerical': 0.009870660313138189, 'mean_word_length': 1.3269992082343627, 'pattern_counts': {'":': 0, '<': 9, '<?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': '3697154', 'n_tokens_mistral': 915, 'n_tokens_neox': 897, 'n_words': 270}