<commit_before>require 'yaml'
require 'hashie/dash'

module Travis
  module Worker
    DIRECTORIES = ['.', '~', '/etc']

    class Config < Hashie::Dash
      autoload :Vagrant, 'travis/worker/config/vagrant'

      #
      # API
      #

      property :amqp,     :default => Hashie::Mash.new(:username => "guest", :password => "<PASSWORD>", :host => "localhost", :vhost => "travis")

      property :redis,    :default => Hashie::Mash.new(:url => ENV['REDIS_URL'])
      property :reporter, :default => Hashie::Mash.new(:http => Hashie::Mash.new)
      property :shell,    :default => Hashie::Mash.new(:buffer => 0)
      property :workers,  :default => 3
      property :timeouts, :default => Hashie::Mash.new(:before_script => 120, :after_script => 120, :script => 600, :bundle => 300)

      def initialize
        config = load
        @vms = Vagrant.new(config.delete('vms'))
        super(Hashie::Mash.new(config))
      end

      def vms
        @vms ||= Vagrant::Config.new
      end

      def load
        YAML.load_file(filename)
      end

      def filename
        DIRECTORIES.each do |directory|
          filename = File.expand_path('.worker.yml', directory)
          return filename if File.exists?(filename)
        end
        raise "Could not find a .worker.yml configuration file. Valid locations are: #{DIRECTORIES.join(', ')}"
      end<commit_msg>gotta pass a default here<commit_after>require 'yaml'
require 'hashie/dash'

module Travis
  module Worker
    DIRECTORIES = ['.', '~', '/etc']

    class Config < Hashie::Dash
      autoload :Vagrant, 'travis/worker/config/vagrant'

      #
      # API
      #

      property :amqp,     :default => Hashie::Mash.new(:username => "guest", :password => "<PASSWORD>", :host => "localhost", :vhost => "travis")

      property :redis,    :default => Hashie::Mash.new(:url => ENV['REDIS_URL'])
      property :reporter, :default => Hashie::Mash.new(:http => Hashie::Mash.new)
      property :shell,    :default => Hashie::Mash.new(:buffer => 0)
      property :workers,  :default => 3
      property :timeouts, :default => Hashie::Mash.new(:before_script => 120, :after_script => 120, :script => 600, :bundle => 300)

      def initialize
        config = load
        @vms = Vagrant.new(config.delete('vms') || {})
        super(Hashie::Mash.new(config))
      end

      def vms
        @vms ||= Vagrant::Config.new
      end

      def load
        YAML.load_file(filename)
      end

      def filename
        DIRECTORIES.each do |directory|
          filename = File.expand_path('.worker.yml', directory)
          return filename if File.exists?(filename)
        end
        raise "Could not find a .worker.yml configuration file. Valid locations are: #{DIRECTORIES.join(', ')}"
      end
{'fraction_non_alphanumeric': 0.1495664739884393, 'fraction_numerical': 0.010115606936416185, 'mean_word_length': 2.6386333771353483, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 39, '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': '5600871', 'n_tokens_mistral': 916, 'n_tokens_neox': 866, 'n_words': 205}