<commit_before>class ApiUsers < Grape::API
  resource :users do
    params_user = -> do
      params do
        optional :id, type: Integer, desc: "The numerical ID of the user for whom to return results for."
        optional :screen_name, type: String, desc: "The username of the user for whom to return results for."
      end
    end

    helpers do
      def user
        @_user ||= begin
          user = User.find(id: params[:id] || params[:user_id], screen_name: params[:screen_name])
          raise Aclog::Exceptions::Forbidden unless permitted_to_see?(user)
          user
        end
      end
    end

    desc "Returns the stats of a user, specified by username or user ID.", example_params: { user_id: 280414022 }
    params_user[]
    get "stats", rabl: "user_stats" do
      @user = user
    end

    desc "Returns the list of the users who discovored the Tweets of a user, specified by username or user ID.", example_params: { user_id: 99008565 }
    params_user[]
    get "discovored_by", rabl: "user_discovored_by_and_users" do
      @result = user.count_discovered_by.take(Settings.users.count)
    end

    desc "Returns the list of the users discovored by a user, specified by username or user ID.", example_params: { screen_name: "cn" }
    params_user[]
    get "discovored_users", rabl: "user_discovored_by_and_users" do
      @result = user.count_discovered_users.take(Settings.users.count)
    end

    desc "", nodoc: true, example_params: { ids: "280414022,99008565" }
    params do
      optional :id, type: String, desc: "Use ids"
      optional :ids, type: String, desc: "Use this"
      optional :user_id, type: String, desc: "Use ids"
      optional :user_ids, type: String, desc: "Use ids"
    end
    get "screen_name" do
      # does not use RABL
      user_ids = (params[:id] || params[:ids] || params[:user_id] || params[:user_ids]).split(",").map { |i| i.to_i }
      User.where(id: user_ids).pluck(:id, :screen_name).map { |id, screen_name| { id: id, screen_name: screen_name } }
    end
  end
end<commit_msg>fix typo in api/users<commit_after>class ApiUsers < Grape::API
  resource :users do
    params_user = -> do
      params do
        optional :id, type: Integer, desc: "The numerical ID of the user for whom to return results for."
        optional :screen_name, type: String, desc: "The username of the user for whom to return results for."
      end
    end

    helpers do
      def user
        @_user ||= begin
          user = User.find(id: params[:id] || params[:user_id], screen_name: params[:screen_name])
          raise Aclog::Exceptions::Forbidden unless permitted_to_see?(user)
          user
        end
      end
    end

    desc "Returns the stats of a user, specified by username or user ID.", example_params: { user_id: 280414022 }
    params_user[]
    get "stats", rabl: "user_stats" do
      @user = user
    end

    desc "Returns the list of the users who discovered the Tweets of a user, specified by username or user ID.", example_params: { user_id: 99008565 }
    params_user[]
    get "discovered_by", rabl: "user_discovered_by_and_users" do
      @result = user.count_discovered_by.take(Settings.users.count)
    end

    desc "Returns the list of the users discovered by a user, specified by username or user ID.", example_params: { screen_name: "cn" }
    params_user[]
    get "discovered_users", rabl: "user_discovered_by_and_users" do
      @result = user.count_discovered_users.take(Settings.users.count)
    end

    desc "", nodoc: true, example_params: { ids: "280414022,99008565" }
    params do
      optional :id, type: String, desc: "Use ids"
      optional :ids, type: String, desc: "Use this"
      optional :user_id, type: String, desc: "Use ids"
      optional :user_ids, type: String, desc: "Use ids"
    end
    get "screen_name" do
      # does not use RABL
      user_ids = (params[:id] || params[:ids] || params[:user_id] || params[:user_ids]).split(",").map { |i| i.to_i }
      User.where(id: user_ids).pluck(:id, :screen_name).map { |id, screen_name| { id: id, screen_name: screen_name } }
    end
  end
end
{'fraction_non_alphanumeric': 0.10875912408759124, 'fraction_numerical': 0.01654501216545012, 'mean_word_length': 3.0743310208126857, 'pattern_counts': {'":': 0, '<': 5, '<?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': '726648', 'n_tokens_mistral': 1351, 'n_tokens_neox': 1306, 'n_words': 430}