<commit_before>'use strict';

const CommonImport = require('../../util/CommonImport');

const types = ['query', 'shape'];

const Path = require('./Path');
const Query = require('./Query');

class Gremlin {

  constructor(promisify, requestWithDefaultOpts) {
    this._promisify = promisify;
    this._request = requestWithDefaultOpts;
  }

  type(type) {
    if (!type || types.indexOf(type) === -1) {
      throw new Error("Please pass in valid type, can be: 'query' or 'shape'.");
    }
    const gremlin = new this.constructor(this._promisify, this._request);
    gremlin._query = gremlin._query.bind(gremlin, type);
    return gremlin;
  }

  V() {
    return this._v(Array.prototype.slice.call(arguments));
  }

  Vertex() {
    return this._v(Array.prototype.slice.call(arguments));
  }

  M() {
    return this.Morphism();
  }

  Morphism() {
    const path = new Path(['M', []]);
    path._query = this._query;
    return path;
  }

  _v() {
    const query = new Query(['V', arguments[0]], this._promisify);
    query._query = this._query;
    return query;
  }

  _query(type, gremlinText, callback) {<commit_msg>Path object should not know _query function.<commit_after>'use strict';

const CommonImport = require('../../util/CommonImport');

const types = ['query', 'shape'];

const Path = require('./Path');
const Query = require('./Query');

class Gremlin {

  constructor(promisify, requestWithDefaultOpts) {
    this._promisify = promisify;
    this._request = requestWithDefaultOpts;
  }

  type(type) {
    if (!type || types.indexOf(type) === -1) {
      throw new Error("Please pass in valid type, can be: 'query' or 'shape'.");
    }
    const gremlin = new this.constructor(this._promisify, this._request);
    gremlin._query = gremlin._query.bind(gremlin, type);
    return gremlin;
  }

  V() {
    return this._v(Array.prototype.slice.call(arguments));
  }

  Vertex() {
    return this._v(Array.prototype.slice.call(arguments));
  }

  M() {
    return this.Morphism();
  }

  Morphism() {
    const path = new Path(['M', []]);
    // path._query = this._query;
    return path;
  }

  _v() {
    const query = new Query(['V', arguments[0]], this._promisify);
    query._query = this._query;
    return query;
  }

  _query(type, gremlinText, callback) {
{'fraction_non_alphanumeric': 0.16271929824561404, 'fraction_numerical': 0.0017543859649122807, 'mean_word_length': 3.263551401869159, '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': '2100753', 'n_tokens_mistral': 761, 'n_tokens_neox': 728, 'n_words': 170}