<commit_before>var remote = require('remote');
var app = remote.require('app');
var crypto = require('crypto');
var uuid = require('node-uuid');
var level = require('levelup');
var path = require('path');
var db = level(path.join(process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'], 'Library/Application Support/Kitematic/data', 'db'));

Metrics = {};

Metrics.enable = function () {
  db.put('metrics.enabled', true);
};

Metrics.disable = function () {
  db.put('metrics.enabled', false);
};

Metrics.enabled = function (callback) {
  db.get('metrics.enabled', function (err, value) {
    if (err) {
      callback(false);
    } else {
      callback(value);
    }
  });
};

Metrics.trackEvent = function (name) {
  if (!name) {
    return;
  }
  db.get('metrics.enabled', function (err, value) {
    if (err || !value) {
      return;
    }
    db.get('metrics.uuid', function (err, uuid) {
      if (err) {
        return;
      }
      mixpanel.track('docker_gui ' + name, {
        distinct_id: uuid,
        version: app.getVersion()
      });
    });
  });
};

Metrics.prepareTracking = function () {
  db.get('metrics.enabled', function (err, value) {
    if (err && err.notFound) {
      var settings = Settings.findOne();
      if (settings && settings.tracking) {
        db.put('metrics.enabled', !!settings.tracking);
      } else {
        db.put('metrics.enabled', true);<commit_msg>fixing names<commit_after>var remote = require('remote');
var app = remote.require('app');
var crypto = require('crypto');
var uuid = require('node-uuid');
var level = require('levelup');
var path = require('path');
var db = level(path.join(process.env[(process.platform === 'win32') ? 'USERPROFILE' : 'HOME'], 'Library/Application Support/Kitematic/data', 'db'));

Metrics = {};

Metrics.enable = function () {
  db.put('metrics.enabled', true);
};

Metrics.disable = function () {
  db.put('metrics.enabled', false);
};

Metrics.enabled = function (callback) {
  db.get('metrics.enabled', function (err, value) {
    if (err) {
      callback(false);
    } else {
      callback(value);
    }
  });
};

Metrics.trackEvent = function (name) {
  if (!name) {
    return;
  }
  db.get('metrics.enabled', function (err, value) {
    if (err || !value) {
      return;
    }
    db.get('metrics.uuid', function (err, uuid) {
      if (err) {
        return;
      }
      mixpanel.track(name, {
        distinct_id: uuid,
        version: app.getVersion(),
        product: 'Docker GUI'
      });
    });
  });
};

Metrics.prepareTracking = function () {
  db.get('metrics.enabled', function (err, value) {
    if (err && err.notFound) {
      var settings = Settings.findOne();
      if (settings && settings.tracking) {
        db.put('metrics.enabled', !!settings.tracking);
      } else {
        db.put('metrics.enabled', true);
{'fraction_non_alphanumeric': 0.1837666900913563, 'fraction_numerical': 0.0014054813773717498, 'mean_word_length': 3.044034090909091, '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': '7122228', 'n_tokens_mistral': 905, 'n_tokens_neox': 904, 'n_words': 192}