<commit_before>require "digest/sha1"

class User < ActiveRecord::Base
  has_many :user_logs
  has_many :post_votes
  attr_accessor :current_email
  class AlreadyFavoritedError < Exception; end

  def set_api_key
    self.api_key = SecureRandom.urlsafe_base64
  end

  def self.authenticate_with_api_key(username, api_key)
    where(:name => username, :api_key => api_key).first
  end

  def log(ip)<commit_msg>Remove unused exception.<commit_after>require "digest/sha1"

class User < ActiveRecord::Base
  has_many :user_logs
  has_many :post_votes
  attr_accessor :current_email

  def set_api_key
    self.api_key = SecureRandom.urlsafe_base64
  end

  def self.authenticate_with_api_key(username, api_key)
    where(:name => username, :api_key => api_key).first
  end

  def log(ip)
{'fraction_non_alphanumeric': 0.08290816326530612, 'fraction_numerical': 0.007653061224489796, 'mean_word_length': 4.814814814814815, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 7, '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': '1023472', 'n_tokens_mistral': 286, 'n_tokens_neox': 271, 'n_words': 57}