<commit_before>module Audibleturk
  class Error < StandardError 
    class Shell < Error; end
    class SFTP < Error; end
    class Argument < Error
      class Format < Argument; end
    end
    class Amazon < Error
      class UnreviewedContent < Amazon; end
    end
  end

  module Utility
    require 'open3'

    #much like Kernel#system, except it doesn't spew STDERR and
    #STDOUT all over your screen! (when called with multiple args,
    #which with Kernel#systems kills the chance to do shell style
    #stream redirects like 2>/dev/null)
    def self.system_quietly(*cmd)
      exit_status=nil
      err=nil
      Open3.popen3(*cmd) do |stdin, stdout, stderr, wait_thread|
        yield(stdin, stdout, stderr, wait_thread) if block_given?
        err = stderr.gets(nil)
        [stdin, stdout, stderr].each{|stream| stream.send('close')}
        exit_status = wait_thread.value
      end
      if exit_status.to_i > 0
        raise Audibleturk::Error::Shell, err
      else
        return true
      end
    end
  end #Audibleturk::Utility

  class Config
    require 'yaml'
    @@default_file = File.expand_path("~/.audibleturk")
    attr_reader :path
<commit_msg>Utility.system_quietly returns STDOUT on success, when available<commit_after>module Audibleturk
  class Error < StandardError 
    class Shell < Error; end
    class SFTP < Error; end
    class Argument < Error
      class Format < Argument; end
    end
    class Amazon < Error
      class UnreviewedContent < Amazon; end
    end
  end

  module Utility
    require 'open3'

    #much like Kernel#system, except it doesn't spew STDERR and
    #STDOUT all over your screen! (when called with multiple args,
    #which with Kernel#systems kills the chance to do shell style
    #stream redirects like 2>/dev/null)
    def self.system_quietly(*cmd)
      exit_status=nil
      err=nil
      out=nil
      Open3.popen3(*cmd) do |stdin, stdout, stderr, wait_thread|
        yield(stdin, stdout, stderr, wait_thread) if block_given?
        err = stderr.gets(nil)
        out = stdout.gets(nil)
        [stdin, stdout, stderr].each{|stream| stream.send('close')}
        exit_status = wait_thread.value
      end
      if exit_status.to_i > 0
        err = err.chomp if err
        raise Audibleturk::Error::Shell, err
      elsif out
        return out.chomp
      else
        return true
      end
    end
  end #Audibleturk::Utility

  class Config
    require 'yaml'
    @@default_file = File.expand_path("~/.audibleturk")
    attr_reader :path

{'fraction_non_alphanumeric': 0.08003169572107766, 'fraction_numerical': 0.003961965134706815, 'mean_word_length': 2.648843930635838, 'pattern_counts': {'":': 0, '<': 17, '<?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': '3903578', 'n_tokens_mistral': 812, 'n_tokens_neox': 775, 'n_words': 243}