<commit_before>var _ = require('underscore');
var Backbone = require('backbone');
var Branches = require('../collections/branches');
var Commits = require('../collections/commits');
var config = require('../config');
var util = require('../util');
var cookie = require('../cookie');

module.exports = Backbone.Model.extend({
  constructor: function(attributes, options) {
    this.api = options && options.api ? options.api : util.getApiFlavor();
    var attr = this.api === 'gitlab' ? this.pickGitlab(attributes) :
      this.pickGithub(attributes);

    Backbone.Model.call(this, attr);
  },

  pickGitlab: function (attr) {
    return {
      id: attr.id,
      description: attr.description,

      // Gitlab API does not have a boolean value for whether the
      // project is a fork; only how many forks the project has.
      fork: false,
      homepage: attr.web_url,
      default_branch: attr.default_branch,
      name: attr.name,
      owner: {
        id: attr.owner.id,
        login: attr.owner.username
      },
      permissions: attr.permissions,
      private: !attr.public,
      updated_at: attr.last_activity_at
    };
  },

  pickGithub: function (attr) {
    return {
      id: attr.id,
      description: attr.description,
      fork: attr.fork,
      homepage: attr.homepage,
      default_branch: attr.default_branch,
      name: attr.name,
      owner: {
        id: attr.owner.id,
        login: attr.owner.login
      },
      permissions: attr.permissions,
      private: attr.private,
      updated_at: attr.updated_at,
      issue_count: attr.open_issues_count
    };
  },
<commit_msg>Fix ID property (possible mismatch with api docs)<commit_after>var _ = require('underscore');
var Backbone = require('backbone');
var Branches = require('../collections/branches');
var Commits = require('../collections/commits');
var config = require('../config');
var util = require('../util');
var cookie = require('../cookie');

module.exports = Backbone.Model.extend({
  constructor: function(attributes, options) {
    this.api = options && options.api ? options.api : util.getApiFlavor();
    var attr = this.api === 'gitlab' ? this.pickGitlab(attributes) :
      this.pickGithub(attributes);

    Backbone.Model.call(this, attr);
  },

  pickGitlab: function (attr) {
    return {
      id: attr.id,
      description: attr.description,

      // Gitlab API does not have a boolean value for whether the
      // project is a fork; only how many forks the project has.
      fork: false,
      homepage: attr.web_url,
      default_branch: attr.default_branch,
      name: attr.name,
      owner: {
        id: attr.owner ? attr.owner.id : attr.namespace ? attr.namespace.owner_id : '',
        login: attr.owner ? attr.owner.username : attr.namespace ? attr.namespace.name : ''
      },
      permissions: attr.permissions,
      private: !attr.public,
      updated_at: attr.last_activity_at
    };
  },

  pickGithub: function (attr) {
    return {
      id: attr.id,
      description: attr.description,
      fork: attr.fork,
      homepage: attr.homepage,
      default_branch: attr.default_branch,
      name: attr.name,
      owner: {
        id: attr.owner.id,
        login: attr.owner.login
      },
      permissions: attr.permissions,
      private: attr.private,
      updated_at: attr.updated_at,
      issue_count: attr.open_issues_count
    };
  },

{'fraction_non_alphanumeric': 0.1303066037735849, 'fraction_numerical': 0.0, 'mean_word_length': 2.7041484716157207, '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': '1023459', 'n_tokens_mistral': 1033, 'n_tokens_neox': 1017, 'n_words': 245}