<commit_before>'use strict';

var _ = require('lodash'),
    RSVP = require('rsvp'),
    logger = require('winston'),
    QueueWorker = require('./lib/queue_worker.js');

var DEFAULT_NUM_WORKERS = 1,
    DEFAULT_SANITIZE = true,
    DEFAULT_TASK_SPEC = {
      inProgressState: 'in_progress',
      timeout: 300000 // 5 minutes
    };

/**
 * @constructor
 * @param {Firebase} ref A Firebase reference to the queue.
 * @param {Object} options (optional) Object containing possible keys:
 *   - taskId: {String} the task specification ID for the workers.
 *   - numWorkers: {Number} The number of workers to create for this task.
 *   - sanitize: {Boolean} Whether to sanitize the 'data' passed to the
 *       processing function of internal queue keys.
 * @param {Function} processingFunction A function that is called each time to
 *   process a task. This function is passed four parameters:
 *     - data {Object} The current data at the location.
 *     - progress {Function} A function to update the progress percent of the
 *         queue item for informational purposes. Pass it a number between
 *         0 and 100. Returns a promise of whether the operation was completed
 *         successfully.
 *     - resolve {Function} An asychronous callback function - call this
 *         function when the processingFunction completes successfully. This
 *         takes an optional Object parameter that, if passed, will overwrite
 *         the data at the queue item location, and returns a promise of
 *         whether the operation was successful.
 *     - reject {Function} An asynchronous callback function - call this
 *         function if the processingFunction encounters an error. This takes
 *         an optional String or Object parameter that will be stored in the
 *         '_error_details/error' location in the queue item and returns a
 *         promise of whether the operation was successful.
 * @returns {RSVP.Promise} A resolved promise if the Queue is initialized
 *   correctly, or a rejection if the parameters or Firebase reference are
 *   incorrect.
 */
function Queue() {
  var self = this;
  var constructorArguments = arguments;

  return new RSVP.Promise(function(resolve, reject) {
    var error;
    self.numWorkers = DEFAULT_NUM_WORKERS;
    self.sanitize = DEFAULT_SANITIZE;<commit_msg>Few more comments cleaned up<commit_after>'use strict';

var _ = require('lodash'),
    RSVP = require('rsvp'),
    logger = require('winston'),
    QueueWorker = require('./lib/queue_worker.js');

var DEFAULT_NUM_WORKERS = 1,
    DEFAULT_SANITIZE = true,
    DEFAULT_TASK_SPEC = {
      inProgressState: 'in_progress',
      timeout: 300000 // 5 minutes
    };

/**
 * @constructor
 * @param {Firebase} ref A Firebase reference to the queue.
 * @param {Object} options (optional) Object containing possible keys:
 *   - taskId: {String} the task specification ID for the workers.
 *   - numWorkers: {Number} The number of workers to create for this task.
 *   - sanitize: {Boolean} Whether to sanitize the 'data' passed to the
 *       processing function of internal queue keys.
 * @param {Function} processingFunction A function that is called each time to
 *   process a task. This function is passed four parameters:
 *     - data {Object} The current data at the location.
 *     - progress {Function} A function to update the progress percent of the
 *         task for informational purposes. Pass it a number between 0 and 100.
 *         Returns a promise of whether the operation was completed
 *         successfully.
 *     - resolve {Function} An asychronous callback function - call this
 *         function when the processingFunction completes successfully. This
 *         takes an optional Object parameter that, if passed, will overwrite
 *         the data at the task location, and returns a promise of whether the
 *         operation was successful.
 *     - reject {Function} An asynchronous callback function - call this
 *         function if the processingFunction encounters an error. This takes
 *         an optional String or Object parameter that will be stored in the
 *         '_error_details/error' location in the task and returns a promise
 *         of whether the operation was successful.
 * @returns {RSVP.Promise} A resolved promise if the Queue is initialized
 *   correctly, or a rejection if the parameters or Firebase reference are
 *   incorrect.
 */
function Queue() {
  var self = this;
  var constructorArguments = arguments;

  return new RSVP.Promise(function(resolve, reject) {
    var error;
    self.numWorkers = DEFAULT_NUM_WORKERS;
    self.sanitize = DEFAULT_SANITIZE;
{'fraction_non_alphanumeric': 0.0721184803605924, 'fraction_numerical': 0.0051513200257566, 'mean_word_length': 3.131205673758865, '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': '386999', 'n_tokens_mistral': 1208, 'n_tokens_neox': 1163, 'n_words': 530}