<commit_before>require 'uri'
require 'redis'

def redis
  $redis ||= (

    env = ENV['RACK_ENV'] || 'development'
    yaml = YAML.load(File.read('config/redis.yml'))[env]
    db = yaml.keys.first
    config = yaml[db]
    config['db'] = db        
    url = URI("redis://#{config['host']}:#{config['port']}/#{config['db']}")

    ::Redis.new(
      :host => url.host,
      :port => url.port,
      :db => url.path[1..-1],
      :password => url.password
    )
  )
end<commit_msg>Connecting to redis on boot<commit_after>require 'uri'
require 'redis'

def redis
  $redis ||= (

    env = ENV['RACK_ENV'] || 'development'
    yaml = YAML.load(File.read('config/redis.yml'))[env]
    db = yaml.keys.first
    config = yaml[db]
    config['db'] = db
    $redis_url = "#{config['host']}:#{config['port']}/#{config['db']}"
    url = URI("redis://#{$redis_url}")

    ::Redis.new(
      :host => url.host,
      :port => url.port,
      :db => url.path[1..-1],
      :password => <PASSWORD>
    )
  )
end

redis
{'fraction_non_alphanumeric': 0.21968190854870775, 'fraction_numerical': 0.003976143141153081, 'mean_word_length': 2.7434944237918217, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 12, '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': '6694371', 'n_tokens_mistral': 401, 'n_tokens_neox': 390, 'n_words': 66}