<commit_before># Copyright 2016 - Niji
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module Gyro
  # Print nice and colored output for various error/success/title messages of Gyro
  #
  module Log
    @quiet = false
    def self.quiet=(value)
      @quiet = value
    end

    def self.title(str) # bg yellow
      puts "\n\e[44;37m#{str}\e[0m" unless @quiet
    end

    def self.error(str)
      puts "\e[1;31m! #{str}\e[0m" unless @quiet
    end

    def self.info(str)
      puts "\e[1;33m> #{str}\e[0m" unless @quiet
    end

    def self.success(str)
      puts "\e[1;32m√ #{str}\e[0m" unless @quiet
    end

    def self.fail!(message, stacktrace: false)
      Gyro::Log.error message
      raise message if stacktrace
      exit 1
    end

    def self.prompt(str, url = nil)
      prompt = "\e[1;36m   ! #{str} [y/n]?\e[0m "
      url_info = ' ' * 10 + "\e[0;37m (use '?' to show in browser)\e[0m"
      print prompt
      print "#{url_info}\r#{prompt}" if url

      answer = read_char do |c|
        `open '#{url}'` if url && (c == '?')
        "yn\003".include?(c.downcase) # \003 = ctrl-C
      end
      puts answer + (url ? ' ' * url_info.length : '')
      answer.casecmp('y').zero?
    end

    ######################################################################

    def self.read_char
      stop = false
      typed_char = ''
      begin
        system('stty raw -echo')
        until stop
          typed_char = STDIN.getc.chr
          stop = yield typed_char
        end
      ensure
        system('stty -raw echo')
      end
      typed_char
    end
    private_class_method :read_char
  end
end<commit_msg>Remove unused methods prompt + read_char in Log.rb<commit_after># Copyright 2016 - Niji
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

module Gyro
  # Print nice and colored output for various error/success/title messages of Gyro
  #
  module Log
    @quiet = false
    def self.quiet=(value)
      @quiet = value
    end

    def self.title(str) # bg yellow
      puts "\n\e[44;37m#{str}\e[0m" unless @quiet
    end

    def self.error(str)
      puts "\e[1;31m! #{str}\e[0m" unless @quiet
    end

    def self.info(str)
      puts "\e[1;33m> #{str}\e[0m" unless @quiet
    end

    def self.success(str)
      puts "\e[1;32m√ #{str}\e[0m" unless @quiet
    end

    def self.fail!(message, stacktrace: false)
      Gyro::Log.error message
      raise message if stacktrace
      exit 1
    end
  end
end
{'fraction_non_alphanumeric': 0.12612612612612611, 'fraction_numerical': 0.01976169718105202, 'mean_word_length': 2.6500530222693532, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5647635', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1072, 'n_words': 376}