<commit_before>class User
  include MongoMapper::Document
  many :authorizations

  key :name, String
  key :username, String
  key :email, String
  key :website, String
  key :bio, String
  key :twitter_image, String

  key :following_ids, Array
  many :following, :in => :following_ids, :class_name => 'User'

  key :followers_ids, Array
  many :followers, :in => :followers_ids, :class_name => 'User'

  def follow! followee
    following << followee
    save
    followee.followers << self
    followee.save
  end

  def unfollow! followee
    following_ids.delete(followee.id)
    save
    followee.followers_ids.delete(id)
    followee.save
  end

  def following? user 
    following.include? user
  end

  many :updates, :dependent => :destroy

  def self.create_from_hash!(hsh)
    create!(
      :name => hsh['user_info']['name'],
      :username => hsh['user_info']['nickname'],
      :website => hsh['user_info']['urls']['Website'],
      :bio => hsh['user_info']['description'],
      :twitter_image => hsh['user_info']['image']
    )
  end

  timestamps!

  def timeline
    following.map(&:updates).flatten
  end

  after_create :follow_yo_self

  private

  def follow_yo_self
    following << self
    followers << self
    save
  end
end

class Update
  include MongoMapper::Document

  belongs_to :user
  key :text, String

  validates_length_of :text, :maximum => 140

  timestamps!
end

class Authorization
  include MongoMapper::Document
  
  belongs_to :user

  key :uid, Integer, :required => true
  key :provider, String, :required => true<commit_msg>fixing rackup error<commit_after>class Update
  include MongoMapper::Document

  belongs_to :user
  key :text, String

  validates_length_of :text, :maximum => 140

  timestamps!
end

class User
  include MongoMapper::Document
  many :authorizations

  key :name, String
  key :username, String
  key :email, String
  key :website, String
  key :bio, String
  key :twitter_image, String

  key :following_ids, Array
  many :following, :in => :following_ids, :class_name => 'User'

  key :followers_ids, Array
  many :followers, :in => :followers_ids, :class_name => 'User'

  def follow! followee
    following << followee
    save
    followee.followers << self
    followee.save
  end

  def unfollow! followee
    following_ids.delete(followee.id)
    save
    followee.followers_ids.delete(id)
    followee.save
  end

  def following? user 
    following.include? user
  end

  many :updates, :dependent => :destroy

  def self.create_from_hash!(hsh)
    create!(
      :name => hsh['user_info']['name'],
      :username => hsh['user_info']['nickname'],
      :website => hsh['user_info']['urls']['Website'],
      :bio => hsh['user_info']['description'],
      :twitter_image => hsh['user_info']['image']
    )
  end

  timestamps!

  def timeline
    following.map(&:updates).flatten
  end

  after_create :follow_yo_self

  private

  def follow_yo_self
    following << self
    followers << self
    save
  end
end

class Authorization
  include MongoMapper::Document
  
  belongs_to :user

  key :uid, Integer, :required => true
  key :provider, String, :required => true
{'fraction_non_alphanumeric': 0.11399620012666245, 'fraction_numerical': 0.0018999366687777073, 'mean_word_length': 3.5322812051649928, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 29, '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': '2420346', 'n_tokens_mistral': 1065, 'n_tokens_neox': 1008, 'n_words': 265}