<commit_before>storage = require 'lib/storage'
deltasLib = require 'lib/deltas'

class CocoModel extends Backbone.Model
  idAttribute: "_id"
  loaded: false
  loading: false
  saveBackups: false
  @schema: null

  getMe: -> @me or @me = require('lib/auth').me

  initialize: ->
    super()
    if not @constructor.className
      console.error("#{@} needs a className set.")
    @markToRevert()
    @addSchemaDefaults()
    @once 'sync', @onLoaded, @
    @on 'error', @onError, @
    @saveBackup = _.debounce(@saveBackup, 500)

  type: ->
    @constructor.className

  clone: (withChanges=true) ->
    # Backbone does not support nested documents
    clone = super()
    clone.set($.extend(true, {}, if withChanges then @attributes else @_revertAttributes))<commit_msg>Fixed a bug where sometimes thang avatar views wouldn't render the portrait, because 'loading' wouldn't be set to false properly.<commit_after>storage = require 'lib/storage'
deltasLib = require 'lib/deltas'

class CocoModel extends Backbone.Model
  idAttribute: "_id"
  loaded: false
  loading: false
  saveBackups: false
  @schema: null

  getMe: -> @me or @me = require('lib/auth').me

  initialize: ->
    super()
    if not @constructor.className
      console.error("#{@} needs a className set.")
    @markToRevert()
    @addSchemaDefaults()
    @on 'sync', @onLoaded, @
    @on 'error', @onError, @
    @saveBackup = _.debounce(@saveBackup, 500)

  type: ->
    @constructor.className

  clone: (withChanges=true) ->
    # Backbone does not support nested documents
    clone = super()
    clone.set($.extend(true, {}, if withChanges then @attributes else @_revertAttributes))
{'fraction_non_alphanumeric': 0.12953995157384987, 'fraction_numerical': 0.0036319612590799033, 'mean_word_length': 3.68271954674221, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '7290545', 'n_tokens_mistral': 527, 'n_tokens_neox': 509, 'n_words': 148}