<commit_before>class Cleaner
  def initialize f
    @f=f
    [f.bin, f.sbin, f.lib].select{|d|d.exist?}.each{|d|clean_dir d}
    # info pages suck
    f.info.rmtree if f.info.directory? and not f.skip_clean? f.info
  end

private
  def strip path, args=''
    return if @f.skip_clean? path
    puts "strip #{path}" if ARGV.verbose?
    path.chmod 0644 # so we can strip
    unless path.stat.nlink > 1
      system "strip", *(args+path)
    else
      path = path.to_s.gsub ' ', '\\ '

      # strip unlinks the file and recreates it, thus breaking hard links!
      # is this expected behaviour? patch does it too… still, this fixes it
      tmp = `/usr/bin/mktemp -t homebrew_strip`.chomp
      begin
        `/usr/bin/strip #{args} -o #{tmp} #{path}`
        `/bin/cat #{tmp} > #{path}`
      ensure
        FileUtils.rm tmp
      end<commit_msg>HOMEBREW_KEEP_INFO to keep info pages<commit_after>class Cleaner
  def initialize f
    @f=f
    [f.bin, f.sbin, f.lib].select{|d|d.exist?}.each{|d|clean_dir d}

    unless ENV['HOMEBREW_KEEP_INFO'].nil?
      f.info.rmtree if f.info.directory? and not f.skip_clean? f.info
    end
  end

private
  def strip path, args=''
    return if @f.skip_clean? path
    puts "strip #{path}" if ARGV.verbose?
    path.chmod 0644 # so we can strip
    unless path.stat.nlink > 1
      system "strip", *(args+path)
    else
      path = path.to_s.gsub ' ', '\\ '

      # strip unlinks the file and recreates it, thus breaking hard links!
      # is this expected behaviour? patch does it too… still, this fixes it
      tmp = `/usr/bin/mktemp -t homebrew_strip`.chomp
      begin
        `/usr/bin/strip #{args} -o #{tmp} #{path}`
        `/bin/cat #{tmp} > #{path}`
      ensure
        FileUtils.rm tmp
      end
{'fraction_non_alphanumeric': 0.12964020559680184, 'fraction_numerical': 0.0057110222729868645, 'mean_word_length': 2.421875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5740059', 'n_tokens_mistral': 633, 'n_tokens_neox': 615, 'n_words': 183}