<commit_before>class Api::V1::Clouds::BansController < Api::V1Controller

  before_filter :fetch_cloud

  # Fetches all bans for specified cloud.
  #
  #   cloud_id    - Id of the jurisdiction to what this cloud belongs
  #   offender_id - Id of what offender to filter the result by
  #   enforcer_id - Id of what enforcer to filter the result by
  #
  # Returns a Bans collection
  def index

    @bans = @cloud.bans.where(
      params.select { |k,v| [:offender_id,:enforcer_id].include?(k.to_sym) }
    ).order_by(due: :desc)

    render status: 200
  end

  # Creates a new ban for a user on the Cloud.
  #
  #   cloud_id    - Id of the jurisdiction to what this cloud belongs
  #   offender_id - Id of the user receiving the ban.
  #   ban         - A Hash with parameters to be passed to the ban.
  #                   :due - Set the date to which the ban will last
  #                   :reason - 1 to 140 characters why the user deserves the ban
  #
  # Returns a newly created Ban resource
  def create

    @offender = User.find(params[:offender_id])
    @enforcer = current_user

    @ban = @cloud.bans.find_or_initialize_by offender: @offender
    @ban.write_attributes params[:ban]
    @ban.enforcer ||= @enforcer
<commit_msg>Clean up bans controller.<commit_after>class Api::V1::Clouds::BansController < Api::V1Controller

  before_filter :fetch_cloud

  # Fetches all bans for specified cloud.
  #
  #   cloud_id    - Id of the jurisdiction to what this cloud belongs
  #   offender_id - Id of what offender to filter the result by
  #   enforcer_id - Id of what enforcer to filter the result by
  #
  # Returns a Bans collection
  def index

    @bans = @cloud.bans.where(
      params.select { |k,v| [:offender_id,:enforcer_id].include?(k.to_sym) }
    ).order_by(due: :desc)

    render status: 200
  end

  # Creates a new ban for a user on the Cloud.
  #
  #   cloud_id    - Id of the jurisdiction to what this cloud belongs
  #   offender_id - Id of the user receiving the ban.
  #   ban         - A Hash with parameters to be passed to the ban.
  #                   :due - Set the date to which the ban will last
  #                   :reason - 1 to 140 characters why the user deserves the ban
  #
  # Returns a newly created Ban resource
  def create

    @offender = User.find(params[:offender_id])
    @enforcer = current_user

    @ban = @cloud.bans.find_or_initialize_by(offender: @offender)
    @ban.write_attributes(params[:ban])
    @ban.enforcer ||= @enforcer

{'fraction_non_alphanumeric': 0.08219727345629511, 'fraction_numerical': 0.007217321571772253, 'mean_word_length': 2.6530014641288435, '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': '5519179', 'n_tokens_mistral': 824, 'n_tokens_neox': 787, 'n_words': 277}