<commit_before>require 'carrierwave'

CarrierWave::SanitizedFile.sanitize_regexp = /[^[:word:]\.\-\+]/

CarrierWave.configure do |config|
  config.root = 
    if ::Rails.env.test?
      "/tmp/#{::Rails.application.class.parent_name.underscore}/#{::Rails.env}"
    else
      "/data/#{::Rails.application.class.parent_name.underscore}/#{::Rails.env}"
    end
end

module Daddy
  module Uploader
    class Base < CarrierWave::Uploader::Base

      def store_dir
        "#{model.class.to_s.underscore.pluralize}/#{model.id.to_s}/#{mounted_as}"
      end

    end
  end
end<commit_msg>carrierwave<commit_after>CarrierWave::SanitizedFile.sanitize_regexp = /[^[:print:]]/

CarrierWave.configure do |config|
  config.root = 
    if ::Rails.env.test?
      "/tmp/#{::Rails.application.class.parent_name.underscore}/#{::Rails.env}"
    else
      "/data/#{::Rails.application.class.parent_name.underscore}/#{::Rails.env}"
    end
    
  if File.exists?('config/aws.yml')
    require 'carrierwave/storage/fog'
    config.storage :fog
    config.cache_storage :fog

    config.fog_provider = 'fog/aws'
    aws = YAML.load_file('config/aws.yml')

    config.fog_credentials = {
      provider: 'AWS',
      aws_access_key_id: aws['s3']['access_key_id'],
      aws_secret_access_key: aws['s3']['secret_access_key'],
      region: aws['s3']['region']
    }
    config.fog_directory = aws['s3']['bucket']
  end
end

module Daddy
  module Uploader
    class Base < CarrierWave::Uploader::Base

      def store_dir
        "#{model.class.to_s.underscore.pluralize}/#{model.id.to_s}/#{mounted_as}"
      end

    end
  end
end
{'fraction_non_alphanumeric': 0.16407706650093226, 'fraction_numerical': 0.002486016159105034, 'mean_word_length': 3.398907103825137, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5733267', 'n_tokens_mistral': 604, 'n_tokens_neox': 589, 'n_words': 79}