<commit_before>'use strict';

var fs = require('fs');
var path = require('path');
var protobuf = require('protocol-buffers');

var types = require('./types.js');

// Create a string `source` containing all the protocol buffer definitions
// for riak.
var dir = path.resolve(__dirname, 'riak_pb', 'src');
var source = fs.readdirSync(dir)
  .filter(function (filename) {
    return (path.extname(filename) === '.proto');
  })
  .map(function (filename) {
    return fs.readFileSync(path.join(dir, filename));
  })
  .join('\n')
  .replace(/option java_.+/g, '')
  .replace(/import .+/g, '');

// Parse and export messages
var messages = protobuf(source);
var schemas = [];
Object.keys(types).forEach(function (name) {
  var id = types[name];

  if (name in messages) {
    schemas[id] = messages[name];
  } else {
    schemas[id] = {
      type: 2,
      message: true,
      empty: true,
      name: name,
      encode: function () { return; },
      decode: function () { return null; },
      encodingLength: function () { return 0; }
    };
  }
});

module.exports = schemas;<commit_msg>[fix] fake buffer: true, in protocol.js<commit_after>'use strict';

var fs = require('fs');
var path = require('path');
var protobuf = require('protocol-buffers');

var types = require('./types.js');

// Create a string `source` containing all the protocol buffer definitions
// for riak.
var dir = path.resolve(__dirname, 'riak_pb', 'src');
var source = fs.readdirSync(dir)
  .filter(function (filename) {
    return (path.extname(filename) === '.proto');
  })
  .map(function (filename) {
    return fs.readFileSync(path.join(dir, filename));
  })
  .join('\n')
  .replace(/option java_.+/g, '')
  .replace(/import .+/g, '');

// Parse and export messages
var messages = protobuf(source);
var schemas = [];
Object.keys(types).forEach(function (name) {
  var id = types[name];

  if (name in messages) {
    schemas[id] = messages[name];
  } else {
    schemas[id] = {
      type: 2,
      message: true,
      empty: true,
      buffer: true,
      name: name,
      encode: function () { return; },
      decode: function () { return null; },
      encodingLength: function () { return 0; }
    };
  }
});

module.exports = schemas;
{'fraction_non_alphanumeric': 0.17491007194244604, 'fraction_numerical': 0.0017985611510791368, 'mean_word_length': 3.27063339731286, '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': '6109545', 'n_tokens_mistral': 720, 'n_tokens_neox': 705, 'n_words': 190}