<commit_before>"use strict";

import Datastore = require('@google-cloud/datastore');
import { Query } from '@google-cloud/datastore/query';
import { DatastoreKey } from '@google-cloud/datastore/entity';
import { CommitResult } from '@google-cloud/datastore/request';

const datastore = new Datastore({});
const _ = require('underscore');

interface FieldDefinition {
  name: string;
  type: type;
}

interface Schema {
  kind: string;
  fields: {
    [fieldName: string]: FieldDefinition
  };
}

interface Model {
  key(): DatastoreKey;
}

class VisitSchema implements Schema {
  readonly kind = "visit";
  readonly
}

class Visit {
  static kind() {
    return 'visit';
  }

  static defaults() {
    return {
      created: new Date()
    };
  }

  static fields() {
    return [
      'created'
    ];
  }


  static key(id: number): DatastoreKey {
    if (id) {
      return datastore.key([Visit.kind(), id]);
    }
    return datastore.key([Visit.kind()]);
  }

  static async query(q: Query) {
    let results = await datastore.runQuery(q);
    results[0] = results[0].map(Visit.fromEntity);
    return results;
  }

  static fromEntity(entity: any): Visit {
    let ret = new Visit();
    Object.assign(ret, _.pick(entity, Visit.fields()));
    let key = entity[datastore.KEY];
    ret.id = key && key.path && key.path[1];
    return ret;
  }

  static all() {
    return datastore.createQuery(Visit.kind());
  }

  static async deleteById(id: number) {
    let key = Visit.key(id);
    return await datastore.delete(key);
  }

  id: number;
  created: Date;

  constructor() {
  }

  toObj(): any {
    return _.pick(this, Visit.fields());
  }

  key(): DatastoreKey {
    return Visit.key(this.id);
  }

  async save(): Promise<CommitResult> {
    return await datastore.save({
      key: this.key(),
      data: this.toObj()
    });
  }

  async delete() {
    datastore.delete(this.key());
  }
}

module.exports = {
  datastore,
  Visit
};
<commit_msg>Fix merge conflicts<commit_after>"use strict";

import Datastore = require('@google-cloud/datastore');
import { Query } from '@google-cloud/datastore/query';
import { DatastoreKey } from '@google-cloud/datastore/entity';
import { CommitResult } from '@google-cloud/datastore/request';

const datastore = new Datastore({});
const _ = require('underscore');

// interface FieldDefinition {
//   name: string;
//   type: type;
// }
//
// interface Schema {
//   kind: string;
//   fields: {
//     [fieldName: string]: FieldDefinition
//   };
// }
//
// interface Model {
//   key(): DatastoreKey;
// }
//
// class VisitSchema implements Schema {
//   readonly kind = "visit";
//   readonly
// }

class Visit {
  static kind() {
    return 'visit';
  }

  static defaults() {
    return {
      created: new Date()
    };
  }

  static fields() {
    return [
      'created'
    ];
  }


  static key(id: number): DatastoreKey {
    if (id) {
      return datastore.key([Visit.kind(), id]);
    }
    return datastore.key([Visit.kind()]);
  }

  static async query(q: Query) {
    let results = await datastore.runQuery(q);
    results[0] = results[0].map(Visit.fromEntity);
    return results;
  }

  static fromEntity(entity: any): Visit {
    let ret = new Visit();
    Object.assign(ret, _.pick(entity, Visit.fields()));
    let key = entity[datastore.KEY];
    ret.id = key && key.path && key.path[1];
    return ret;
  }

  static all() {
    return datastore.createQuery(Visit.kind());
  }

  static async deleteById(id: number) {
    let key = Visit.key(id);
    return await datastore.delete(key);
  }

  id: number;
  created: Date;

  constructor() {
  }

  toObj(): any {
    return _.pick(this, Visit.fields());
  }

  key(): DatastoreKey {
    return Visit.key(this.id);
  }

  async save(): Promise<CommitResult> {
    return await datastore.save({
      key: this.key(),
      data: this.toObj()
    });
  }

  async delete() {
    datastore.delete(this.key());
  }
}

module.exports = {
  datastore,
  Visit
};

{'fraction_non_alphanumeric': 0.15843569816996741, 'fraction_numerical': 0.0015041363750313362, 'mean_word_length': 2.866279069767442, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '2522383', 'n_tokens_mistral': 1369, 'n_tokens_neox': 1332, 'n_words': 306}