<commit_before>class Wallaby::DecoratorFinder
  def self.find_model(model_class)
    find_class(model_class) ||
    Wallaby::ResourceDecorator.model_decorator(model_class)
  end

  def self.find_resource(model_class)
    find_class(model_class) || Wallaby::ResourceDecorator
  end

  protected
  def self.cached_subclasses
    Rails.cache.fetch 'wallaby/decorator_finder' do
      Wallaby::ResourceDecorator.subclasses.reject do |klass|
        klass.name.blank?
      end
    end
  end

  def self.find_class(model_class)
    cached_subclasses.find do |klass|
      klass.model_class == model_class
    end
  end
end<commit_msg>use a constant for decorator_finder<commit_after>class Wallaby::DecoratorFinder
  DEFAULT_DECORATOR = Wallaby::ResourceDecorator

  def self.find_model(model_class)
    find_class(model_class) ||
    DEFAULT_DECORATOR.model_decorator(model_class)
  end

  def self.find_resource(model_class)
    find_class(model_class) || DEFAULT_DECORATOR
  end

  protected
  def self.cached_subclasses
    Rails.cache.fetch 'wallaby/decorator_finder' do
      DEFAULT_DECORATOR.subclasses.reject do |klass|
        klass.name.blank?
      end
    end
  end

  def self.find_class(model_class)
    cached_subclasses.find do |klass|
      klass.model_class == model_class
    end
  end
end
{'fraction_non_alphanumeric': 0.07444359171143515, 'fraction_numerical': 0.0, 'mean_word_length': 3.958174904942966, 'pattern_counts': {'":': 0, '<': 3, '<?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': '4427280', 'n_tokens_mistral': 434, 'n_tokens_neox': 436, 'n_words': 75}