<commit_before>module Easemob
  module Users
    def create_user(username, password, nickname = nil)
      valid_username!(username)
      request(:post, 'users', json: { username: username, password: password, nickname: nickname })
    end

    def create_users(users)
      users.map { |user| valid_username!(user['username'] || user[:username]) }
      request(:post, 'users', json: users)
    end

    def get_user(username)
      request(:get, "users/#{username}")
    end

    def query_users(limit, cursor = nil)
      params = { limit: limit }
      params[:cursor] = cursor unless cursor.nil?
      request(:get, 'user', params: params)
    end

    def delete_user(username)
      request :delete, "users/#{username}"
    end

    def delete_users!(number = 100)
      request :delete, 'users', params: { limit: number }
    end

    private

    def valid_username!(username)
      raise UserNameError, "#{username} is invalid for easemob" unless username[/[a-zA-Z0-9_-]*/] == username
    end
  end
end<commit_msg>Remove parenthesis as ruby support it.<commit_after>module Easemob
  module Users
    def create_user(username, password, nickname = nil)
      valid_username!(username)
      request :post, 'users', json: { username: username, password: password, nickname: nickname }
    end

    def create_users(users)
      users.map { |user| valid_username!(user['username'] || user[:username]) }
      request :post, 'users', json: users
    end

    def get_user(username)
      request :get, "users/#{username}"
    end

    def query_users(limit, cursor = nil)
      params = { limit: limit }
      params[:cursor] = cursor unless cursor.nil?
      request :get, 'user', params: params
    end

    def delete_user(username)
      request :delete, "users/#{username}"
    end

    def delete_users!(number = 100)
      request :delete, 'users', params: { limit: number }
    end

    private

    def valid_username!(username)
      raise UserNameError, "#{username} is invalid for easemob" unless username[/[a-zA-Z0-9_-]*/] == username
    end
  end
end
{'fraction_non_alphanumeric': 0.12397491558128317, 'fraction_numerical': 0.00482392667631452, 'mean_word_length': 3.1397205588822357, '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': '4698462', 'n_tokens_mistral': 636, 'n_tokens_neox': 605, 'n_words': 176}