<commit_before># frozen_string_literal: true

module API
  module Authentication
    extend ActiveSupport::Concern

    included do
      before do
        authenticate_app!
      end
    end
  end

  class BaseWithoutAuth < Grape::API
    def self.filter(fields)
      Filterator::V2.filter_from_fields(fields)
    end

    FILTERS = {
      announcements: filter(Announcement.fields(:id, :text, :expiry)),
      apps: filter(APIKey.fields(:id, :app_name, :user_id, :github_link)),
      commits: filter(CommitStatus.fields(:id, :commit_sha, :status)),
      deletions: filter(DeletionLog.fields(:id, :post_id, :is_deleted)),
      tags: filter(DomainTag.fields(:id, :name, :description)),
      feedbacks: filter(Feedback.fields(:id, :feedback_type, :post_id, :user_id)),
      posts: filter(Post.fields(:id, :title, :link, :site_id, :user_link, :username, :user_reputation)),
      reasons: filter(Reason.fields(:id, :reason_name, :weight)),
      smokeys: filter(SmokeDetector.fields(:id, :last_ping, :location, :user_id)),
      domains: filter(SpamDomain.fields(:id, :domain, :whois)),
      users: filter(User.fields(:id, :username, :stack_exchange_account_id)),
      mods: filter(ModeratorSite.fields(:id, :user_id, :site_id)),
      sites: filter(Site.fields(:id, :site_name, :site_url)),
      comments: filter(PostComment.fields(:id, :user_id, :text))<commit_msg>Revert "Yes, I'm lost"<commit_after># frozen_string_literal: true

module API
  module Authentication
    included do
      before do
        authenticate_app!
      end
    end
  end

  class BaseWithoutAuth < Grape::API
    def self.filter(fields)
      Filterator::V2.filter_from_fields(fields)
    end

    FILTERS = {
      announcements: filter(Announcement.fields(:id, :text, :expiry)),
      apps: filter(APIKey.fields(:id, :app_name, :user_id, :github_link)),
      commits: filter(CommitStatus.fields(:id, :commit_sha, :status)),
      deletions: filter(DeletionLog.fields(:id, :post_id, :is_deleted)),
      tags: filter(DomainTag.fields(:id, :name, :description)),
      feedbacks: filter(Feedback.fields(:id, :feedback_type, :post_id, :user_id)),
      posts: filter(Post.fields(:id, :title, :link, :site_id, :user_link, :username, :user_reputation)),
      reasons: filter(Reason.fields(:id, :reason_name, :weight)),
      smokeys: filter(SmokeDetector.fields(:id, :last_ping, :location, :user_id)),
      domains: filter(SpamDomain.fields(:id, :domain, :whois)),
      users: filter(User.fields(:id, :username, :stack_exchange_account_id)),
      mods: filter(ModeratorSite.fields(:id, :user_id, :site_id)),
      sites: filter(Site.fields(:id, :site_name, :site_url)),
      comments: filter(PostComment.fields(:id, :user_id, :text))
{'fraction_non_alphanumeric': 0.14904552129221732, 'fraction_numerical': 0.0007342143906020558, 'mean_word_length': 4.482897384305835, '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': '6590576', 'n_tokens_mistral': 921, 'n_tokens_neox': 907, 'n_words': 176}