<commit_before>
module Bixby

  module ScriptUtil

    module UseBundle

      # Load the libraries for the given bundle. Searches all available
      # repositories.
      def use_bundle(name)
        repos = Dir.glob(File.join(Bixby.repo_path, "*"))
        repos.each do |repo|
          next if not File.directory? repo

          lib = File.join(repo, name, "lib")
          $: << lib
          if File.directory? lib then
            Dir.glob(File.join(lib, "*.rb")).each{ |f| require f }
          end
        end
      end
    end

    include UseBundle

    # Reads JSON data from STDIN
    #
    # @return [Object] data found on STDIN (can be Hash, Array, String, etc)
    def get_json_input
      input = read_stdin()
      input.strip! if input
      (input.nil? or input.empty?) ? {} : MultiJson.load(input)
    end

    # Read all available data on STDIN without blocking
    # (i.e., if no data is available, none will be returned)
    #
    # @return [String] data
    def read_stdin
      buff = []
      while true do
        begin
          buff << STDIN.read_nonblock(64000)
        rescue
          break
        end
      end
      return buff.join('')
    end

  end # ScriptUtil
end # Bixby

module Bixby
  extend Bixby::ScriptUtil::UseBundle
end<commit_msg>include use_bundle in object by default<commit_after>
module Bixby

  module ScriptUtil

    module UseBundle

      # Load the libraries for the given bundle. Searches all available
      # repositories.
      def use_bundle(name)
        repos = Dir.glob(File.join(Bixby.repo_path, "*"))
        repos.each do |repo|
          next if not File.directory? repo

          lib = File.join(repo, name, "lib")
          $: << lib
          if File.directory? lib then
            Dir.glob(File.join(lib, "*.rb")).each{ |f| require f }
          end
        end
      end
    end

    include UseBundle

    # Reads JSON data from STDIN
    #
    # @return [Object] data found on STDIN (can be Hash, Array, String, etc)
    def get_json_input
      input = read_stdin()
      input.strip! if input
      (input.nil? or input.empty?) ? {} : MultiJson.load(input)
    end

    # Read all available data on STDIN without blocking
    # (i.e., if no data is available, none will be returned)
    #
    # @return [String] data
    def read_stdin
      buff = []
      while true do
        begin
          buff << STDIN.read_nonblock(64000)
        rescue
          break
        end
      end
      return buff.join('')
    end

  end # ScriptUtil
end # Bixby

module Bixby
  extend Bixby::ScriptUtil::UseBundle
end

class Object
  include Bixby::ScriptUtil::UseBundle
end
{'fraction_non_alphanumeric': 0.08991310918020401, 'fraction_numerical': 0.0037778617302606727, 'mean_word_length': 1.9887133182844243, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, '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': '3806844', 'n_tokens_mistral': 836, 'n_tokens_neox': 803, 'n_words': 259}