<commit_before># -*- encoding: utf-8 -*-
require 'active_record'
require 'active_support'

require 'kasket/active_record_patches'

module Kasket
  autoload :ConfigurationMixin, 'kasket/configuration_mixin'
  autoload :ReloadAssociationMixin, 'kasket/reload_association_mixin'
  autoload :Query, 'kasket/query'

  CONFIGURATION = {:max_collection_size => 100}

  class Version
    MAJOR = 0
    MINOR = 9
    PATCH = 1
    STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
  end

  module_function

  def setup(options = {})
    CONFIGURATION[:max_collection_size] = options[:max_collection_size] if options[:max_collection_size]

    ActiveRecord::Base.extend(Kasket::ConfigurationMixin)
    ActiveRecord::Associations::BelongsToAssociation.send(:include, Kasket::ReloadAssociationMixin)
    ActiveRecord::Associations::BelongsToPolymorphicAssociation.send(:include, Kasket::ReloadAssociationMixin)
    ActiveRecord::Associations::HasOneThroughAssociation.send(:include, Kasket::ReloadAssociationMixin)
  end

  def self.cache_store=(options)
    @cache_store = ActiveSupport::Cache.lookup_store(options)
  end

  def self.cache
    @cache_store ||= Rails.cache
  end

  def clear_local
    if Kasket.cache.respond_to?(:with_local_cache)
      Kasket.cache.send(:local_cache).try(:clear)
    end<commit_msg>Setup is a one time deal<commit_after># -*- encoding: utf-8 -*-
require 'active_record'
require 'active_support'

require 'kasket/active_record_patches'

module Kasket
  autoload :ConfigurationMixin, 'kasket/configuration_mixin'
  autoload :ReloadAssociationMixin, 'kasket/reload_association_mixin'
  autoload :Query, 'kasket/query'

  CONFIGURATION = {:max_collection_size => 100}

  class Version
    MAJOR = 0
    MINOR = 9
    PATCH = 1
    STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
  end

  module_function

  def setup(options = {})
    return if ActiveRecord::Base.extended_by.member?(Kasket::ConfigurationMixin)

    CONFIGURATION[:max_collection_size] = options[:max_collection_size] if options[:max_collection_size]

    ActiveRecord::Base.extend(Kasket::ConfigurationMixin)
    ActiveRecord::Associations::BelongsToAssociation.send(:include, Kasket::ReloadAssociationMixin)
    ActiveRecord::Associations::BelongsToPolymorphicAssociation.send(:include, Kasket::ReloadAssociationMixin)
    ActiveRecord::Associations::HasOneThroughAssociation.send(:include, Kasket::ReloadAssociationMixin)
  end

  def self.cache_store=(options)
    @cache_store = ActiveSupport::Cache.lookup_store(options)
  end

  def self.cache
    @cache_store ||= Rails.cache
  end

  def clear_local
    if Kasket.cache.respond_to?(:with_local_cache)
      Kasket.cache.send(:local_cache).try(:clear)
    end
{'fraction_non_alphanumeric': 0.11069698099142751, 'fraction_numerical': 0.005218039508013418, 'mean_word_length': 5.546341463414634, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3545433', 'n_tokens_mistral': 892, 'n_tokens_neox': 844, 'n_words': 137}